In my cocos2d project, I have two scenes.
I transition between the two using CCDirector’s replaceScene.
Is it possible to save the state of the current scene so that when the scene is changed to a different scene, and then changed back to the original, all the objects and variables in the original are the same.
Thank you,
nonono
Instead of using
replaceScene, you can usepushScene:andpopScene.pushScene:puts the new scene onto a stack and displays it. When you are done that scene, callpopSceneto return to the previous scene on the stack.Note that this does leave your previous scene in memory (as you asked), so it is recommended to use
replaceScene:if you possibly can. If you do usepushScene:andpopScene, it is best to keep your scene stack pretty small.