Hey all,
is there currently a way to manually "finish" up an action? Calling stopAction on the target will only stop it but I am looking for a way for it to also complete its desired action.
Thx in advance!
A fast, easy to use, free, and community supported 2D game engine
Hey all,
is there currently a way to manually "finish" up an action? Calling stopAction on the target will only stop it but I am looking for a way for it to also complete its desired action.
Thx in advance!
[[CCActionManager sharedManager] removeAllActionsFromTarget:someTarget];
or
[[CCActionManager sharedManager] removeActionByTag:someTag target:someTarget];I am not sure what you mean by "finish" up an action. However, calling stopAction on a CCNode in turn just calls [[CCActionManager sharedManager] removeAction:action].
The way I understood this question, which would be mine as well, is to say for example:
move a sprite to position over x seconds.
if you tell that action to finish, you could alter that action to say 'finish the move now in 0.3 seconds'
imagine the scenario where you want to pan you camera over the playing field, but if you play alot you'd rather just skip through that. tapping the screen should just 'finish up' the action.
anyone know how to do that?
Do that in the layer. Keep an ivar for reference to the action. If the player taps, stop the action and calculate the difference between where the sprite is, and where you need it to be.
Hi Benihana,
I tried it like that and it works, but my needs go a little beyond that.
Is there a way where you can just change the duration of the action ?
The thing is, I have a scripted camera sequence (so a CCSequence of various CCMoveTo actions, finishing with a CCCallFuncND action) that I would rather just say "do whatever is left in this sequence in 0.4 seconds).
I tried taking the sequence action and altering its duration property, but the motion wasn't continuous anymore. i.e.
sequence.duration = sequence.elapsed + 0.4;
so, because a user should be able to skip through this sequence at any point, I would otherwise have to figure out which of the actions in the sequence is currently running, then rebuild a sequence with the remaining actions then run that over 0.4 seconds. Not exactly a quick solution to program.
I'm hoping this won't be the only solution to the problem.
You must log in to post.