Menus

How do you make menus for pausing/other interaction purposes? Thanks

There are two common ways:

  1. When you press the pause button, set the playable layers time scale to 0 (don’t pause the GUI layers so you can have time control and animations on the buttons). Restore the time scale when the unpause button is pressed.
  2. The old workaround, when the pause button is pressed, pause the current scene and go to a Pause scene, when the unpause button is pressed go to the previous paused scene. The problem with this one is that the pause menu runs on a different scene, thus making it impossible to access the paused scene variables, global ones only, and has no advantages at all. In other words… use the first option :wink:

Of course there are other common things to do, the GUI objects have to stand in their own GUI layer so they are not moved when you move the playable layers camera. Buttons and so can be classic sprites. There should be some kind of variable/flag to check if the game is paused, this way you can stop some game events to run if the game is paused (for example platformer controls), and stop some GUI events if the game is not paused (click buttons shouldn’t work if the game is not paused).