Javascript Pause code not working

In the forums I saw that there was a way to pause a game using scenes, by using the “game.pushScene()” and “game.popScene()” code.

However when I do this, the game can pause, but I can not unpause it. I do not know if I am just coding it wrong, but if someone could help me with this then it would be much appreciated, as I would like to make a custom pause menu for my games.

1 Like

Just wondering if I can get any clarification on this, since I’m trying to get back into Makecode. Hopefully it can be figured out? Not a super big deal, but I would love to have custom pause screens in my game, instead of the default menu

@Spaghetti_Coder all event handlers are tied to the current scene. the sequence of events for this game looks like this:

  1. game starts. the “on menu button pressed” handler is registered on the initial scene
  2. you press the menu button
  3. the menu button event handler calls push scene
  4. a new scene is created that takes the place of the initial scene. this new scene does not have your “on menu button pressed” code registered in it (remember, that code was run on the start scene)
  5. you press the menu button a second time
  6. the default menu button handler runs which opens the system pause menu

the easiest way to fix this is to call the “on menu button pressed” function a second time after push scene is called. unfortunately, that isn’t something you can do in blocks; you’ll have to do it in javascript

1 Like