#Working With Signals
7 messages · Page 1 of 1 (latest)
I'm not good with English but I try to help. The signal is like a mediating pattern.
One node can send a signal and another node can receive it and do something about it. In this way, two or more nodes can communicate without knowing each other, something that is very important in aggregation systems.
To send a signal just put
signal.emit()
another node can connect to the signal to listen to it and do something
signal.connect(do_something())
func do_something():
.....
The trick for a signal to be heard is in the mediator. The mediator is a node that does need to know those who are going to communicate. In this way, he is in charge of making the connection.
that is the theory part.
In Godot, the mediator always must to be a parent node, or a Autoload if the sceneTree is to complex.
MainNode
|
NodeA
|
NodeX
|
NodeB
MainNode must to be the meditor to connect NodeA and Node B.
Thank you for the help i'm still trying to learn how to code and Im not entirely sure that im asking the right question to solve the problem ive ran into
I figured it out!!
this is a important part in the programmer way.
Signals are dificult to master but it is a important patern in video games.