Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Jashooter |
How do i go about getting the main node so like the parent of all the nodes of a scene through one of its children in an instance of that scene? So like, i have a hitbox inside my character scene and i wish to get the damage variable from the KinematicBody2D node which is the main node of that scene, but i don’t want to use stuff like get_parent().get_parent().damage as the hitbox is an instance of the hitbox scene which i use in other characters as well but not in the same exact position so for other characters i would need to do a different amount of get_parent(). And because the scene will be instanced i can’t go about the get_tree().get_root().get_node(“KinematicBody2D”) way. Is there perhaps a different way of going about this?