0
這工作:Cocos2D - 在幾個CCSprites上使用循環重複動作不能按預期工作......爲什麼?
for (Object *oneObj in allObjects) {
id moveAction = [CCMoveTo actionWithDuration:0.3f position:ccp(tx, ty)];
id rotateAction = [CCRotateTo actionWithDuration:0.3 angle:0.0f];
id action = [CCSpawn actions:moveAction, rotateAction, nil];
id sequence = [CCSequence actions: action,
[CCDelayTime actionWithDuration:0.1f],
nil];
[oneObj runAction:sequence];
}
這不工作(只是一個對象被這個感動):
id moveAction = [CCMoveTo actionWithDuration:0.3f position:ccp(tx, ty)];
id rotateAction = [CCRotateTo actionWithDuration:0.3 angle:0.0f];
id action = [CCSpawn actions:moveAction, rotateAction, nil];
id sequence = [CCSequence actions: action,
[CCDelayTime actionWithDuration:0.1f],
nil];
for (Object *oneObj in allObjects) {
[oneObj runAction:sequence];
}
爲什麼呢?
ahhhhhhhhhhhhhhhhhhhhhhhh .....總是你!謝謝!!!!! – SpaceDog 2013-03-06 19:25:23