I have added sprites to my NSMutable Array now I’d like to get to them; I’m using these methods:
- (void)selectSpriteForTouch:(CGPoint)touchLocation {
for (CCSprite *sprite in selectedSpritesArray) {
if (CGRectContainsPoint(sprite.boundingBox, touchLocation)) {
newSprite = sprite;
break;
}
}
}
- (BOOL)ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event {
CGPoint touchLocation = [self convertTouchToNodeSpace:touch];
[self selectSpriteForTouch:touchLocation];
return TRUE;
}
How do I have to do it correctly? Right now I’m not able to acces some sprites that are overlapped.
Thanks!
Suggestion if you want to access overlapped sprites: