1

I have 3 scenes - a start game scene,a game scene, and a pause game scene.

I have the pause game scene with a home button that goes back to the start game scene and a play button I want to be able to un-pause the game.

I also have a pause button on my game scene that brings me to the pause game scene.

Requirement - How do I go save the current game board, score, and all so it can be playable after the play button is clicked?

NOTE - I don't feel this question needs code to help with answering the question, but if it does I will gladly add it.

Manoj Salvi
  • 2,639
  • 1
  • 17
  • 21
Devbot10
  • 1,193
  • 18
  • 33
  • 1
    What do you mean by "how do I go save the current game board, score and all"? Do you want to save values? Or do you want the gameScene to resume from where it was before clicking pause; i.e. run both the scenes at once? – Dieblitzen Dec 28 '15 at 10:32
  • @user5713130 Do you really need to make a transition to the new scene (PauseScene) when game is paused ? You can just tap on pause button and pop up a pause menu (eg. SKSpriteNode or whatever you use to present a pause menu). That way, you don't need to think how to preserve current game state between transitions. – Whirlwind Dec 28 '15 at 12:01
  • If you are still into preserving data between transitions, you can check out userData property which every node has (SKScene is a node as well). Read more [here](http://stackoverflow.com/a/18924419/3402095) Or you can go with a global struct which defines current game state. Still, I would go without transition to the PauseScene if it isn't really required. – Whirlwind Dec 28 '15 at 12:10
  • 1
    The idea of the pause menu is good, I think I will take that route as a pause scene isn't really necessary as you said. – Devbot10 Dec 28 '15 at 20:19

1 Answers1

1

Try adding subview(Pause Scene) containing Home Button and Play Button on Game Scene. Once Play Button is clicked remove subview(Pause Scene) from Game Scene.

Arpit Dongre
  • 1,683
  • 19
  • 30