How do i check if a node is destroyed?

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

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?

Thanks

:bust_in_silhouette: Reply From: Bartosz

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

Thanks

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

TheBaldChick | 2018-03-25 11:52