Hello, i'm new to cocos2d, i need help about how to detect that a sprite1 move to hit a sprite2 and make some event (eg, BOOM effect, play sound)
i found some information that advise to use CGRectIntersectsRect
but i can't make it work, could you advise me please, Thanks you for all reply
my code
CGSize size = [[Director sharedDirector] winSize];
id move = [MoveBy actionWithDuration:3 position:ccp(350,0)];
id move_back = [move reverse];
id seq1 = [Sequence actions: move, move_back, nil];
Sprite *spritemove = [Sprite spriteWithFile:@"Icon.png"];
spritemove.position = ccp(50 , 280);
[self addChild:spritemove z:4 tag:kTagSpritemove];
[spritemove runAction:[RepeatForever actionWithAction:seq1]];
Sprite *sprite = [Sprite spriteWithFile:@"Icon.png"];
sprite.position = ccp(0 , 0);
[self addChild:sprite z:4 tag:kTagSpriteShoot];
id shootobj = [MoveTo actionWithDuration:0.3 position:ccp(size.width,size.height)];
[sprite runAction:shootobj];