|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
- (void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; CGPoint touchPoint = [touch locationInView: [touch view]]; touchPoint = [[CCDirector sharedDirector] convertToGL: touchPoint]; for (CCSprite *sprite in movableSprites) { CGPoint nodeSpacePosition = [sprite convertToNodeSpace:touchPoint]; if (CGRectContainsPoint( CGRectMake(0, 0, [sprite contentSize].width, [sprite contentSize].height), nodeSpacePosition)) { // some event code; break; } } } |
Filed under: Cocos2d • iPad • iPhone
Like this post? Subscribe to my RSS feed and get loads more!




Leave a Reply