Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道如何立即让我的精灵CCSprite *van从一开始就以可控的速度自动移动,例如int *speed = 1, 2, 3+. 我环顾四周,但我发现的一切都不符合我的需要。这个问题有简单的解决方案吗?
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];
然后您可以在精灵移动时使用 setSpeed 更改速度:
[speed setSpeed: 2.0f];