I’m having serious problem whenever I pause the game, since most of my performSelector: has delay, so it will not execute immediately, but thing goes bad if I’m pausing the game then the performSelector is still calling… How should I overcome this?
I know there is one function under NSObject to cancel all the requests but that’s not really what i’m looking for because I want the method to continue execute if the player resume the game.
According to cocos2d Best Practices you should not use
performSelector:afterDelaydirectly but use cocos2d scheduler instead:Here’s how you schedule your method (assuming self is a
CCNode):Don’t forget to unschedule it in
-tick2:if you want to call it once.