These are my first Cocos2D projects, I'm trying to make a sprite jump in the same place when touched, but I can't make it response because I don't know how to set touch actions on sprites. Here is the code :
-(void) spriteEffect
{
CCSprite *actionEffect = avatar;
id jump = [CCJumpBy actionWithDuration:1 position: ccp(0, 0) height:50 jumps:2];
id sequence = [CCSequence actions: jump, nil];
[actionEffect runAction:sequence];
return yes
}
Should I use a
- (BOOL) ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event
Thanks!
runActioncan be executed on a single sprite, not on a array of sprites... this explain why the action is not working. - sergio