Summary - Signal
- Game Development course
- Intermediate
- Lesson 72/83
- 4 min
Reinforce signal usage with a summary task.
Summary: Signal Architecture in Godot
In this group, you learned Godot's core communication mechanism, the Signal system: built-in signals (pressed, timeout), establishing connections (connect, Callable), custom signal declarations (signal), and emission (emit).
signal coin_collected(val: int)
func _ready():
coin_collected.connect(_on_coin)
coin_collected.emit(5)
func _on_coin(val: int):
print("Coins gained: ", val)Thanks to signals, nodes in your scenes communicate cleanly without needing direct hard-coded references to each other.
Practice Build a complete signal system
In the script, define signal skor_artti(puan). Inside _ready, connect this signal to _on_skor and trigger it with skor_artti.emit(10). In _on_skor(puan), print with print("Yeni skor: ", puan).
Starter code
extends Node
# Sinyal tanimi buraya
func _ready():
# Bagla ve yayinla
func _on_skor(puan):
# Puani yazdirSample solution
extends Node
signal skor_artti(puan)
func _ready():
skor_artti.connect(_on_skor)
skor_artti.emit(10)
func _on_skor(puan):
print("Yeni skor: ", puan)Expected output
Yeni skor: 10
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 What is the correct end-to-end sequence of the signal workflow?
- Declaration (signal) -> Connection (connect) -> Emission (emit) Correct answer
- Emission (emit) -> Declaration (signal) -> Bind
- Emit -> Declare -> Disconnect -> Connect
- Connection (connect) -> Deletion -> Declaration -> Emit
Explanation: The correct flow is first declaring the signal, then connecting it to a listener function, and finally emitting it when the event occurs.
2 Complete the signal cycle
signal game_started
func setup():
game_started.____(_on_game_started)
game_started.emit()
signal game_started
func setup():
game_started.connect(_on_game_started)
game_started.emit()
Explanation: Before emitting, the signal is connected to the listener function via the connect method.
3 Signal summary match
| Term | Meaning |
|---|---|
signal my_signal |
Custom signal declaration |
my_signal.connect(fn) |
Registers function as listener |
my_signal.emit() |
Triggers and emits signal |
Button.pressed |
Built-in UI signal |