Topic was automatically imported from the old Question2Answer platform.
Asked By
Leandro
I’m working on a shmup. Many enemies need to know the position of the player ship, so I use this:
target = get_node(“…/PlayerShip”).position
Problem is that sometimes my player ship will be removed from the game, when it explodes so enemy scenes won’t find it and crash the game. How to check first if the player ship exists in the parent scene? Is there something like this in Godot?
if node_exists ("../PlayerShip"):
target = get_node("../PlayerShip").position