开发者

cocos2d sprites disable touches

i haves game with cocos2d i have many sprites i'm using touch to sprite with this

CGRectContainsPoint([[gameImages objectAtIndex:i] boundingBox], location)
CGPoint location = [touch locationInView: [touch开发者_运维百科 view]];
    location = [[CCDirector sharedDirector] convertToGL: location];

but when i touched the sprite must be deleted i have

[self removeChild:[gameImages objectAtIndex:bacvacIndexner[0]] cleanup:YES];

but the touch works because i use the object coordinates and i cant delete object when i removin that from child what can i do?why i can get the touch event for sprite . are anything without coordinate method?


Use a callback so a higher class remove the object. Inside your to-be-removed class:

[self.touchDelegate performSelector:@selector(removeMe:) withObject:self afterDelay:0.0f];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜