I’ve got an end of level layer added to game, each level has its own scene. I want to be able to restart the current scene. Obviously the scene will change but the layer will remain the same. How is this done. I’ve tried-
CCScene *currentScene = [[CCDirector sharedDirector]runningScene];
[[CCDirector sharedDirector]replaceScene:currentScene];
Thanks
This does not work because you can’t replace the same scene object with itself:
Instead you have to create a new instance of your scene, like so:
If you don’t know what the current scene class is, then this ought to work:
Assuming you’re using ARC as everyone should these days. Otherwise add an autorelease.