Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggested fix for issue #224, FlxTilemap.ray() Result value always null #225

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.

None yet

2 participants