![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | simonmakesgoodgames |
Been trying for hours, can’t figure it out. I’m making a golf game, and I’m instancing a Hole scene and a Ball scene to the Main scene. I want the Hole scene’s Area2D node to send a signal when a physics body (the ball) enters it, and I want the main scene to listen to it.
On the Hole scene’s script, I wrote
func _ready():
$Area2D.connect("body_entered", self, "_on_Area2D_body_entered")
if $Area2D.is_connected("body_entered", self, "_on_Area2D_body_entered") == true:
print('hey')
and my engine prints “hey”. However, none of my tests on the Main Node script with func _on_Area2D_body_entered():
works. I feel like I’m not connecting the right parts in the right order or something. I know this is supposed to be obvious, but none of the references I’ve found online (including the docs) are specific enough for me to understand.