Skip to content

Instantly share code, notes, and snippets.

@AbelToy
Created March 10, 2011 16:40
Show Gist options
  • Save AbelToy/864427 to your computer and use it in GitHub Desktop.
Save AbelToy/864427 to your computer and use it in GitHub Desktop.
frontCollidePoint on World
/**
* 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