Stop multiple jumps


I have a button on click I am performing jumpTo so if I press button more than one time it performs multiple jumps. So,
How to prevent with multiple jumps.

CCJumpTo *pJumpTo = new CCJumpTo();
auto jumpto=JumpTo::create(0.7,target->getPosition(),100,1);


first of all CCJumpTo *pJumpTo = new CCJumpTo(); doesnt do anything here. its better to avoid new altogether.
to prevent multiple jumps you must create states for the target.


I think the easiest way to do it would be to tag the action and then check if an action with that tag is running on the node before running it again.

// make sure target isn't running any actions with tag 1
if (target->getNumberOfRunningActionsByTag(1) == 0) {
    auto jumpto=JumpTo::create(0.7,target->getPosition(),100,1);
    // tag action so we can check if the target is running it


Thanks a lot sir its working as i want