+1 vote

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?

Godot version 3.2.3
in Engine by (56 points)

2 Answers

0 votes
by (636 points)

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

So the idea was not to answer this question but the one I linked to ;-)

0 votes

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!

by (298 points)

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?

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.