我想知道如何立即让我的 Sprite CCSprite *van 从一开始就以可控的速度自动移动,比如 int *speed = 1, 2, 3+ 。我环顾四周,但我发现的一切都不符合我的需求。这个问题有简单的解决方案吗?

最佳答案

您必须使用 CCSpeed 操作:

CCSpeed* speed= [CCSpeed actionWithAction: yourMoveAction speed: 1.0f];
// yourMoveAction is an action like CCMoveTo for example
[sprite runAction: speed];

然后你可以在 Sprite 移动时使用 setSpeed 改变速度:
[speed setSpeed: 2.0f];

关于objective-c - Cocos2D - 自动设置 Sprite 移动速度,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13888256/

10-12 04:41
查看更多