Reputation: 18159
Is it possible, in cocos2d-iphone, to "freeze" your scene, and run different scene (say, a pause scene), and when you are done with this scene, you can change back to the original scene and resume it just fine? I guess it is possible, someone once told me I could stack scenes or something in the CCDirector, but I did not quite understand what methods are necessary.
Upvotes: 0
Views: 346
Reputation: 64477
This is what you're looking for:
// show the pause scene
[[CCDirector sharedDirector] pushScene:pauseScene];
...
// return back to the game scene
[[CCDirector sharedDirector] popScene];
Keep in mind that the original scene remains in memory, so ideally the pushed scene should be lightweight, memory-wise.
The popScene transition can not be animated with CCSceneTransition. Cocos2D 2.0 is supposed to fix that, but the planned improvement is not yet available.
Upvotes: 1