只是一个简单的问题 - 设置精灵无限运动序列的最有效方法是什么?我目前正在运行:
-(void) pathToMove:(CCParticleSystemQuad*) system
{
CGSize screenSize = [[CCDirector sharedDirector] winSize];
int width = screenSize.width;
int height = screenSize.height;
float randX = arc4random() % width;
float randY = arc4random() % (height - 200);
CGPoint start = system.position;
CGPoint end = ccp(randX, randY);
float finalDistance = ccpDistance(start, end);
float speedToMove = 500.0;
float durationToMove = finalDistance / speedToMove;
[system runAction:[CCSequence actions:[CCMoveTo actionWithDuration:durationToMove position:ccp(randX,randY)],[CCCallFuncN actionWithTarget:self selector:@selector(completedCurve:)],nil]];
}
-(void) completedCurve:(id) sender
{
[self pathToMove:sender];
}
但是我担心这可能会导致一些奇怪的僵尸和/或泄漏,通过一次又一次的动作调用。还有更好的方法吗?