这是我的开机按钮:
CCMenuItemImage *bottone = [CCMenuItemImage itemFromNormalImage:@"Icon-72.png" selectedImage:@"Icon-72.png" target:self selector:@selector(bottone)];
bottone.position = ccp(200,-100);
CCMenu *menu = [CCMenu menuWithItems:bottone, nil];
[self addChild:menu];
这是我触摸按钮时的方法:
-(void) bottone
{
float scaleDuration = 1.0;
float waitDuration = 5.0;
_invincible = YES;
CCParticleSystemQuad *boostEffect = [_boostEffects nextParticleSystem];
[boostEffect resetSystem];
[_ship runAction:
[CCSequence actions:
// [CCMoveBy actionWithDuration:scaleDuration position:ccp(winSize.width * 0.6, 0)],
[CCDelayTime actionWithDuration:waitDuration],
// [CCMoveBy actionWithDuration:scaleDuration position:ccp(-winSize.width * 0.6, 0)],
nil]];
[self runAction:
[CCSequence actions:
// [CCScaleTo actionWithDuration:scaleDuration scale:0.75],
[CCDelayTime actionWithDuration:waitDuration],
[CCScaleTo actionWithDuration:scaleDuration scale:1.0],
[CCCallFunc actionWithTarget:self selector:@selector(boostDone)],
nil]];
}
它可以工作,但我希望玩家可以使用 X 次加电。解释得更好,触摸按钮 1 或 2 次并停止,按钮变得无法使用。