Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+5 votes

Hi guys, does anybody know how to pause and resume a game and keep all the running state of the game?

asked in CSC380Jan2024 by (1 point)

2 Answers

+1 vote

The way I have been doing it is by adding a 2d scene with buttons like resume and quit, and instantiating it in the level scene. Then in the level scene, i have a is_paused boolean that tracks if the game is paused. I added an input "p" and when the "p" key is pressed then it changes the visibility of the pause menu, and sets the Engine.timescale to 0. This stops all of the enemies and game processes from moving. if the game is paused and its clicked again, then reverse the previous steps

answered by (1 point)
0

https://www.youtube.com/watch?v=JEQR4ALlwVU
This is the tutorial I used

0 votes

I know luke also had a way of pausing the game if you wanna ask him how he did it although I think he'll want a scroll of aid

answered by (1 point)
...