Created
March 10, 2011 16:40
frontCollidePoint on World
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Returns the Entity at front which collides with the point. | |
* @param x X position | |
* @param y Y position | |
* @return The Entity at front which collides with the point, or null if not found. | |
*/ | |
public function frontCollidePoint(x:Number, y:Number):Entity | |
{ | |
var e:Entity, | |
i:int = 0; | |
do | |
{ | |
e = _renderFirst[_layerList[i]]; | |
while (e) | |
{ | |
if(e.collidePoint(e.x, e.y, x, y)) return e; | |
e = e._renderNext | |
} | |
} | |
while(++i); | |
return null; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment