I am making a game and it all works fine so far - There is one level (a ‘base’ I will use to make all the levels on the game from) that works fine and a menu. The only thing I am having trouble with is how to make a pause button? The game has a lot of sprites, all moving in different (often random) directions. How would I make them all stop and save the information on where they were going at the time?
First, insert a simple event. Then, move all other events so as to make them sub events of the first event. Add then a condition to this event, like “Variable Pause =0”.
Then, add an event that put the variable Pause to 1 and that set time scale to 0 if a key is pressed ( like P or Esc ). Thus, when the player will hit this key, the event of the game will stop ( As variable Pause will be set to 1 ) and the animation, timers, forces will also stop, as time scale will be set to 0.
Finally, add an event like this so as to unpause the game ( Note that this last event must not be put as a sub event of the first event. ) :
Conditions : Variable Pause = 1
Key Space is pressed
Actions : Do = 0 to variable Pause
Set timescale to 1