Search code examples
c++cocos2d-iphonecocos2d-x

How to stop a scheduled function cocos2d-x


I have used
this->schedule(schedule_selector(MyNode::TickMe), 0, 0, 0);

to call a function whenever the player touches the screen.

But I want that as soon as the player stops touching the screen, the scheduled function also stops i.e. dont call the function TickMe anymore.

How can I achieve that?

EDIT:: Okay I got it. There is unschedule function available in CCNode. (Solved)


Solution

  • //unschedule the function.
    
    unschedule(schedule_selector(MyNode::TickMe));