How to make character "respawn" after he falls in the void

Godot Version



so i want my character to return to a spawn after they fall in the void and die

func player_fell():
if player.position.y > 120:
self.global_position = get_node(“/root/spawn”).global_position
rn i have this but nothing actually happens if he falls and i am not sure why unless i have the node root wrong but i think i would get a warning for that.
But he just infinately falls what am i doing wrong ?

When do you call the func player_fell() ?

You probably need to add the position check into your _process function.

something like:

func _process(delta):
   if player.position.y > 120:

Use an Area2D with a WorldBoundaryShape2D shape and listen to the Area2D.body_entered signal to re-spawn the character.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.