0 votes

When my player dies, I try to load my gameover scene.

func hurtplayer(power):
print("hit player with power:"+str(power))
$"/root/global".playerhealth -= power
if($"/root/global".playerhealth < 1):
print("player dead")
global.playsound("hurtplayer", false, globaltransform.origin)
print("coming out of hurtplayer")

It does NOT load this even though it exists and works. It prints player dead and then apparently skips starting gameover.tscn, because it immediately prints "coming out of hurtplayer".


The gameover scene works when i try it by itself. And I copied its path to put into the get_tree so its definitely right...

Is there something wrong in gameover scene:

extends Control

func _ready():
pass # Replace with function body.

func onButtonpressed():
pass # Replace with function body.

It is just simple and works on its own.

in Engine by (36 points)

change__scene returns an Error-code - have you made sure it's OK (i.e. 0)?

Please log in or register to answer this question.

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.