Skip to content

Conversation

cr0ybot
Copy link

@cr0ybot cr0ybot commented Apr 13, 2012

Added rayHit() function to FlxTilemap that explicitly returns an FlxPoint if the ray hits anything, and returns null otherwise. Default ray() function relies on passing a variable as reference to receive the hit result, which does not seem to work. See http://stackoverflow.com/questions/3708371/actionscript-pass-by-reference

…oint if the ray hits anything, and returns null otherwise. Default ray() function relies on passing a variable as reference to receive the hit result, which does not seem to work. See http://stackoverflow.com/questions/3708371/actionscript-pass-by-reference
@moly
Copy link

moly commented Aug 28, 2012

This is unnecessary, see: #224 (comment)

A better fix would be to change:

if(Result == null)
    Result = new FlxPoint();
Result.x = rx;
Result.y = ry;
return false;

to

if(Result != null)
{
    Result.x = rx;
    Result.y = ry;
}
return false;

This makes the code clearer and removes an unnecessary new FlxPoint() creation.

Gama11 added a commit to HaxeFlixel/flixel that referenced this pull request Mar 31, 2014
ray() has exactly the same functionality, it just needed a small fix (see AdamAtomic/flixel#225)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants