CCBigSprite and CCSmallSprite classes are inherited from CCSprite.
spr1,spr2 are instances of them.
All ccTouchesStart,ccTouchesMove,ccTouchesEnd methods overridden from protocol CCTargetedTouchDelegate
for both classes.
problem :in normal cases,touch events working as expected and works good for any sprite instances,
till sprites overlaps.
Touch events works for (CCBigSprite *spr1) if (CCSmallSprite *spr2) is touched.
Because of an overlap issue here and exact position as image shown.
how can I fix this fatal problem ?
both classes have this overridden method same :
-(void)onEnter {
[super onEnter];
[[[CCDirector sharedDirector]touchDispatcher]addTargetedDelegate:self
priority:self.touchPriority swallowsTouches:YES];
}
does it sense ?
also:
setPriority didnt change anyhing.
Im changing manually.
[spr2 setTouchPriority:1];[spr1 setTouchPriority:2];//lower meant to be highest priority or vise versa. didnt help.
this shall be a cocos2d-iphone 2.0 stable version issue ?
The draw order does not influence the order of touch events.
If you tap on small sprite in the above image, only the order the sprites registered themselves with CCTouchDispatcher determines whether small or big sprite receives the first touch events.