1

一段时间后如何停止游戏中的所有动作?

在下面的代码中,我在精灵上调用 runaction。

id actionMove = [CCMoveTo actionWithDuration:actualDuration*2.5 position:ccp(winSize.width + (target.contentSize.width/2), actualY)];
id actionMoveDone = [CCCallFuncN actionWithTarget:self selector:@selector(spriteMoveFinished:)];
id sequece = [CCSequence actions:delayTime1, calFun1, delayTime2, calFun2,actionMove, actionMoveDone, nil];
id repeate = [CCRepeatForever actionWithAction:sequece];

[target runAction:repeate];

在这段代码中,精灵不断移动。如何在一段时间或某种条件后停止上述动作?

4

2 回答 2

2

runAction call Functionstop actionsprite

[CCCallFuncN actionWithTarget:self selector:@selector(setInvisible:)];

- (void)setInvisiblestone:(CCNode *)node
{
    [target stopAllActions];
}
于 2013-04-10T06:30:58.327 回答
-1

所有动作都停止在方法中。

-(void)gameover
{
     [self unscheduleAllSelectors];
}
于 2016-01-08T11:00:27.267 回答