0 votes

I am very new to GDScript and have started creating a platformer game, where if the player touches a spike, he dies. I kill the player using "queue_free()", how can i check if the player is dead or not so that i can make him respawn from another script after a time out function?


in Engine by (70 points)

1 Answer

+1 vote
Best answer

when you use queue_free() you are removing node from scene, so to check if player died just find out if it is still in the scene e.g. get_node("actual_path_to_your_player_node_do_not_copy_paste"), but I think that you should modify your logic and instead of queue_free() you should mark player as dead and just remove it from the scene without freeing memory

by (1,022 points)
selected by


I changed my logic, instead of using queue_free(), i simply made the player invisible and stopped his movement.

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.