Resetting control node

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

Hey how do i reset control node while switching scene’s
like from gameover scene to World scene
In my project when my player hp reaches 0 it switches to gameover scene then when i press restart button with get_tree().change_scene("res://Node2D.tscn") this simple code
it changes scene, But My playerhp is still in 0
setters is used for playerhp, any solution?

This is the same question as How to reset control node UI while switching scene's - Archive - Godot Forum

clemens.tolboom | 2021-01-14 14:12

:bust_in_silhouette: Reply From: clemens.tolboom

See duplicate question How to reset control node UI while switching scene's - Archive - Godot Forum

thats because he asked the question twice. Look - exactly the same user.

Amateur.game.dev. | 2021-01-14 16:43

So the idea was not to answer this question but the one I linked to :wink:

clemens.tolboom | 2021-01-20 14:39

:bust_in_silhouette: Reply From: Amateur.game.dev.

In order to restart a scene, you must use

  get_tree().reload_current_scene()

You do not require to put the scene name in the brackets as the code auto-detects the scene. I hope this helped!

hey did u read my question properly my question is “like from gameover scene to World scene”?
im using a seperate scene to display “gameover”
Any solution for this?

Nirmal | 2021-01-15 06:21