这些是我的第一个 Cocos2D 项目,我试图在触摸时让精灵在同一个地方跳跃,但我无法让它响应,因为我不知道如何在精灵上设置触摸动作。这是代码:
-(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
}
我应该使用
- (BOOL) ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event
谢谢!