For now I just have a sprite moving around the screen to the position I touch. It works fine however if make the sprite move a long distance, and while it’s moving that long distance I click to interrupt it’s action and make it move to a new position, it will move to the new position then once done it will pop back to the previous action of the long move. How can I make any previous move commands cancel out if a new one is issued?
This is my current move function:
pSprite->runAction( CCSequence::actions( CCMoveTo::actionWithDuration( moveDuration, position ), CCCallFuncN::actionWithTarget(mainFrame, callfuncN_selector(HelloWorld::spriteMoveFinished)), NULL) );
And this is what I tried to change it to. I thought adding a tag number to the action, then stopping that tag would work, but it didn’t fix my issue.
I just tried pSprite->stopAllActions() before issuing the new move action, however I really don’t want to use this method because in the future I will have this sprite rotating and doing other things and don’t want to stop those actions, only the move action. Thanks for the help guys.
How do I do it then? Tried searching within the sample projects and can’t answer my own question. Can you please give me an example with my code above? Thank you.
The code I have above, where I set the tag and stop by tag does not work. The move action continues, it does not stop. Only thing that stops it is stopAllActions() but like I said, I don’t want to stop all actions, only the move.
Amazed that 7 years later, cocos2dx still cannot stop the actions of a running sequence by the sequence tag, nor the actions members of the sequence with them action tags…