Cola de acciones cocos2d

Can I do something like actions queue? For example, I have rotate action on click, but if user clicked 10 times, it's must do all rotations step by step (Now it's cancel last rotation action and starting do new by list clicking)

preguntado el 13 de noviembre de 12 a las 16:11

2 Respuestas

As i'm concerned there is no functionality in the SDK for that. But you can write a method which is when ever called pushing the action in an array. When done the finished-notification of the animation should return with an delegate a success state. Then you can pop the action from the array and look up if there was pushed another action meanwhile and start over again.

Espero que esto ayude.

respondido 13 nov., 12:16

Offcourse, what you are looking for is called CCSequence. Here is an example below:

id moveAction = [CCMoveBy actionWithDuration:2 position:ccp(size.width/2,0)];
id rotateAction = [CCRotateBy actionWithDuration: 1 angle:90.0f];

[mySprite runAction: [CCSequence actions:moveAction, rotateAction, moveAction, rotateAction, nil]];

respondido 13 nov., 12:16

yes. But I need add actions to queue, not call two actions, I can't know when action will be called (It's must called after finishing first and all will be ok) - user1021984

Si, intente usar mySprite.actions. P.ej: [mySprite runAction:[CCSequence actions: mySprite.actions, newAction, nil]];. - Majster

Is there any class with an actions property? - Carlos Zafra

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.