I want to Pause a CCNode for a while and after that resume it again. when I use below code separately they work but when I want to resume this CCNode for a specific time when a button clicked it dose't work and occur an Assertion failed(that is: pElement->paused == bPaused ).
//for pausing
this->pauseSchedulerAndActions();
//for resuming
this->resumeSchedulerAndActions();
I use below codes:
#define TIME_FOR_RESUME 5.0f
//function that called when my button click
void myClass::myFunc(CCObject * pSender)
{
this->pauseSchedulerAndActions();
this->scheduleOnce(schedule_selector(myClass::myResumeFunction), TIME_FOR_RESUME);
}
void myClass::myResumeFunction(float dt)
{
this->resumeSchedulerAndActions();
}
you can use this for pausing
this->unscheduleAllSelectors();
and this for resume
this->scheduleUpdate();