Reset/Restart Help?

Godot Version

4.3

Question

Hello all,

I am working with a course on Udemy that is making very barebones games - like the is no clsses being made (or yet), no inheritance, like I said very barebones and I made a little change to the course. On the game I have various UIs setup one for the end of the game, one for a quit, and one that I would like to use as a “reset game”. In that you hit a stop button onscreen during the game, it sets up the Play/Quit UI, and then restart the game with the Play button.

The thing is I have the Stop button working but for the two games in the menu - it doesn’t really “stop” the game and allow for a fresh reload to get everything back to the was it was at the beginning - it acts as a pause button cool but not what I want. Everything is still there, like active bullets/fruit that are instantiated still move. I want that to stop everything DEAD in it tracks when the Stop button is hit and start over when the Play button is hit.

For some reason my brain is just NOT playing ball with me. It doesn’t want to figure this out.

Any help is greatly appreciated.

Thankyou and Regards.

Hi,

you can work with Signals.

On the Stop Button emit the Signal “stop”, every other node you want to “destroy” receives the signal and call the function queue_free(). The play button spawns in everything you need for the start.

Have you tried get_tree().paused = true? You’d have to change the process mode on the buttons to “Always”, however. They won’t work by default when the tree is paused (as all interactions are essentially stopped).

As for how you would "reset’’ the scene, I suppose it depends on what you want. You could just unload and reload the whole scene, or manually move assets back to the starting position and reset their state.

That’s just so crazy it just might work :grinning_face_with_smiling_eyes:.

Thanks for the idea. I have used signals in the past but it’s been a while, I’ll need to study up on it an figure out how it helps.

Thankyou and Cheers.