Skip to content

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

Closed
@FlixelCommunityBot

Description

@FlixelCommunityBot

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

Activity

FlixelCommunityBot

FlixelCommunityBot commented on Sep 13, 2012

@FlixelCommunityBot
Author

#cr0ybot added a commit: AdamAtomic#225

FlixelCommunityBot

FlixelCommunityBot commented on Sep 13, 2012

@FlixelCommunityBot
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

IQAndreas commented on Sep 17, 2012

@IQAndreas
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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @IQAndreas@FlixelCommunityBot

        Issue actions

          Suggested fix for issue #224, FlxTilemap.ray() Result value always null · Issue #7 · FlixelCommunity/flixel