Skip to content

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

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

Closed
FlixelCommunityBot opened this issue Sep 13, 2012 · 3 comments

Comments

@FlixelCommunityBot
Copy link

Issue #225 by: cr0ybot

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

@FlixelCommunityBot
Copy link
Author

#cr0ybot added a commit: AdamAtomic#225

@FlixelCommunityBot
Copy link
Author

Comment by: moly

This is unnecessary, see: AdamAtomic#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.

@IQAndreas
Copy link
Member

Resolved by commit e5a7345

Note that the suggestion by @cry0bot may still be used in the future:
#91

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants