Getting game to restart when character dies

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

Hi, I need help with getting my game to restart when the character is killed. Also for it to restart at the original location and for the enemy character to still be dead if they were before. Any code and advice would be helpful. The game is a 2d maze rpg.

:bust_in_silhouette: Reply From: miskotam

You can reload the current scene with get_tree().reload_current_scene().

To keep your enemy state, you need to store it outside of the scene you reload. You could store it in an autoload singleton for example. You can find more info about Godot singletons in the official docs.