hello
i have got troubled in touch handing.
I added 3 sprites on the same position.
the problem is where touch event occur when i tap the position.
i think the event occur in the toppest z order sprite. but that's not.
it have nothing to do with z-order. just the event occur on the sprite that i add last.
here is code.
@interface SubSprite:CCSprite<CCTargetedTouchDelegate>
....
@end
@implementation SubSprite
...
//added touch handler and methods.
@end
@implementation MainPlay
...
CCSpriteSheet* sheet = [CCSpriteSheet spriteSheetWithFile:@"test.png"];
[self addChild: sheet z:1 ];
SubSprite* s3 = [SubSprite spriteWithSpriteFrameName:@"star3.png"];
s3.position = self.position;
[sheet addChild:s3 z:3];
SubSprite* s2 = [SubSprite spriteWithSpriteFrameName:@"star2.png"];
s2.position = self.position;
[sheet addChild:s2 z:2];
SubSprite* s1 = [SubSprite spriteWithSpriteFrameName:@"star1.png"];
s1.position = self.position;
[sheet addChild:s1 z:1];
....
@end
s1,s2,s3 are in same position and same size.
s3 is the toppest z order sprite.
in app, when i touch s3 sprite, touch event doesn't occur on s3 event handler. it occur on s1 event handler.
what am i wrong??
i hope that event occur on s3 event handler. and that's natural.