我有一些精靈在數組中。現在我想用延遲時間0.5來移動該精靈。當時我在下面的代碼中使用所有精靈都在同一時間下降,但我想逐個降低精靈。我也使用CCDelay方法,但也沒有得到所需的結果。如何在cocos2d中延遲移動精靈?
for (int j = 1; j < [ary count]; j++)
{
torpedoOne.position = ccp(160,580);
id actionMove = [CCMoveTo actionWithDuration:2.0
position:ccp(30 + (j*25),300)];
id deleay = [CCDelayTime actionWithDuration:1.0];
[torpedoOne runAction:[CCSequence actions:actionMove,deleay,nil]];
[self addChild:torpedoOne];
}
首先for循環完成後,行動運行,使所有精靈具有相同的時間acion。
如何在每次進入循環時運行動作?
我是ASLO嘗試COCOS2D: how to animate falling bricks into a grid