Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | MaaaxiKing |
My SceneTree:
Game (Node)
Player (KinematicBody2D) (instanced, script attached) (has an AnimatedSprite as a child with
animation_finished()
connected to the player script)
Ball (RigidBody2D) (instanced, script attached)
In the player script I tried:
func _on_AnimatedSprite_animation_finished():
get_tree().get_root().get_node("Ball").my_function()
get_tree().get_node("Ball").my_function()
get_parent().get_node("Ball").my_function()
.
How can I call a function on the Ball or change some of its properties?
The thing is I don’t know, that when you instance the ball, what is it a child of?? This information is kinda nececarry.
Czselu349 | 2020-06-24 20:30
I instanced the scene even before the game has started. The Ball is child of Game.
MaaaxiKing | 2020-06-24 20:38