I’ve looked around on stack overflow for days and have not seen an answer to my problem. I have several methods in my main game scene that are called by
[self performSelector:@selector(MethodName) withObject:nil afterDelay:.1];
When I leave the game and come back, it looks like all of my methods run at once. I assume this is because the delay time is calculating in the background, but I do not understand how to correct this in cocos2d. I thought I didn’t need to deal with NSTimers with the pause/resume functions in cocos2d? What simple piece of information am I missing here?
You can use cocos-2d schedulers to solve this problem. See the below code:
When you pause the game using :
[[CCDirector sharedDirector] pause];this timer’s will paused. And when you resume the game using :[[CCDirector sharedDirector] resume];It will also resume.