Created
August 16, 2012 02:27
-
-
Save MattRix/3365816 to your computer and use it in GitHub Desktop.
Checking FSprites for overlap with a point
This file contains 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
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