Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Player_0 |
Hello: 3 I have a problem I have created a signal that serves to indicate if an object has collided, if so, it emits it and the same signal connects it to two scripts but it is only emitted in a single script, how can I do so that both are connect, thank you very much in advance.
A signal should be able to be connected to two other nodes. How are you connecting the signal?
exuin | 2021-02-23 16:19
I apologize if some words are not well understood, I do not speak English so I am using google translator:, c.
Thanks for answering: 3, I’m connected to it like this:
script containing the signal:
signal death(object)
func muerte_por_colision():
if colision:
if colision.collider.is_in_group("players"):
emit_signal("death", colision.collider.name)
queue_free()
first script:
bala = BALA.instance()
get_parent().add_child(bala)
bala.position = get_node("Core/salida").global_position
bala.rotation_degrees = $Core.global_rotation_degrees
bala.connect("death", self, "muerte")
second script::
bala = BALA.instance()
get_parent().add_child(bala)
bala.position = get_node("core/point").global_position
bala.rotation_degrees = $core.global_rotation_degrees
bala.connect("death", self, "muerte")
Player_0 | 2021-02-23 16:28
Write the names of the area nodes differently before connecting the signal.
SDGN16 | 2021-02-23 17:00
I already did it, it didn’t work for me :, c
Player_0 | 2021-02-23 18:23