Topic was automatically imported from the old Question2Answer platform.
Asked By
Robster
Old Version
Published before Godot 3 was released.
I’m building breakout. So i have multiple balls that can spawn/instance.
I want to send a signal from the ball, when it’s time to remove a brick. The problem is, there are multiple ball instances and each with different names.
In ball.gd I use emit_signal("destroyBrick")
So in the brick.gd file, if I try and use: ball.connect("destroyBrick", self, "destroyThisBrick") it won’t work as ball changes its name each time it’s added to the scene.
Does anyone know how to use a signal when the receiving node doesn’t know the name of the emitting node?
just guessing here.
1.maybe you create a node with a known name add ball instances to this node and then use: get_children() to find the names of all instances.
2. after creating the instance, use: ball.set_name("ball" + str(ball.get_instance_ID), store names in an array for later use.
Anyway interesting to see how you solve this.