Make sure the body is the player

Not sure if this is the best way to do it, but I made it check if the body was the player Node before reloading the scene, just incase we have other objects bouncing around the scene as distractions.

func _on_maze_body_exited(body):
if body == get_node(“Player”):
get_tree().reload_current_scene()

2 Likes

I did something similar, but using the name property of the body:

func _on_maze_body_exited(body):
	if body.name == "Player":
		get_tree().reload_current_scene()

Didn’t realize there was a get_node() method, that’s helpful to know too!

Privacy & Terms