how do we remove a pushScene if it is no longer required without popping it?
any help much appreciated.
A fast, easy to use, free, and community supported 2D game engine
how do we remove a pushScene if it is no longer required without popping it?
any help much appreciated.
The reason we are asking this is because if we pop the scene it gets executed, but on certain occasions we just want to delete the pushed scene from the stack.
What would you expect to happen if you delete an already pushed scene ?
Hi Riq
Our scenario is:
1. We launch our main game
2. User presses Pause button
3. Menu is shown with Resume Game or Quit Game
4. If user selects Resume Game it resumes game by simply usin popScene
5. However if user selects Quit Game we then replace the current scene (PauseLayer) with the main menu scene (MenuLayer), and this would mean we have a scene still on the stack
So in step 5 we need to remove the scene (cleanup) from the stack before replacing the current scene with the main menu scene
Cheers
If I understood your problem, I think you can just do:
[[Director sharedDirector] popScene];
[[Director sharedDirector] replaceScene:MenuScene];
The first popScene will be "invisible" but it will actually remove the current scene from the stack, as you're trying to do.
Correct me if I'm wrong, riq.
;) that is what we did, but just wanted to make sure. Thanks for your help it is much appreciated.
You must log in to post.