2

I want to restart the current scene i am on. I thought of using replaceScene and replace it with itself. Is that ok to do ?

Level2Scene *scene = [Level2Scene node];
[[CCDirector sharedDirector] replaceScene:scene];

Level2Scene is the current scene I am in.

Thanks Abhinav

AbhinavVinay
  • 303
  • 6
  • 18

1 Answers1

3

Using replaceScene: is a good way to restart the level, if levels are represented by scenes. Just make sure that if you have any global state (stored outside of the scene) that you reset that, too.

Colin Gislason
  • 5,449
  • 2
  • 27
  • 22