Skip to content

Instantly share code, notes, and snippets.

@MattRix
Created August 16, 2012 02:27
Show Gist options
  • Save MattRix/3365816 to your computer and use it in GitHub Desktop.
Save MattRix/3365816 to your computer and use it in GitHub Desktop.
Checking FSprites for overlap with a point
someSprites //your list of sprites you want to check through
Vector2 checkPoint = new Vector2(155,100); //the point you want to check
List<FSprite> overlapSprites = new List<FSprite>(); //a list of sprites that contain the point
foreach(FSprite sprite in someSprites)
{
//"this" should be whatever node you're currently in, or Futile.stage
Vector2 localPoint = sprite.LocalToLocal(this, checkPoint);
if(sprite.boundsRect.Contains(checkPoint))
{
overlapSprites.Add(sprite);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment