gpt4 book ai didi

iphone - cocos2d中如何停止runAction

转载 作者:行者123 更新时间:2023-11-29 13:15:31 24 4
gpt4 key购买 nike

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

在下面的代码中,我在 Sprite 上调用了 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];

在此代码中, Sprite 不断移动。如何在一段时间后或在某些情况下停止上述操作?

最佳答案

runAction 调用 Functionstop actionsprite

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

- (void)setInvisiblestone:(CCNode *)node
{
[target stopAllActions];
}

关于iphone - cocos2d中如何停止runAction,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15917951/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com