How to reset a node/scene

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By adammasterek

Hey! So, I’m new to Godot. I made a Memory Card mini-game inside a Platformer Game - it launches when my platformer Character interacts with Area2D.

The thing is, I would like to make the Memory Card mini-game reset or restart every time I click the “Cancel” button, so when I interact with it again the mini-game will start over. Right now, it just somehow saves all the parameters and when I interact with Area2D again it just continues instead of reloading the node. I would like to restart only the MemoryCard mini-game, not the whole Platformer Game.

Here’s a short video of the problem: https://youtu.be/qiFufTKEL3o

I tried queue_free() but it just deletes the node completely and I cannot interact with it again. Also tried reload_current_scene() and it doesn’t work as well.

:bust_in_silhouette: Reply From: exuin

This is because you’re just hiding the scene, which doesn’t reset anything. The scene is still open in memory. You should create a function that resets the mini-game and call it when you hit the cancel button.