All examples · State and scripts

Signals

What this example shows

A Godot style event channel. State is something that stays true; a signal is something that happened. Two parts of the game talk through it without knowing each other: the Shell (the button) calls petPoked.emit(), and the Screen (where the pet lives) reacts with useSignal(petPoked, …), so the pet flashes. Press P to poke.

useSignal stops listening by itself when its part of the scene goes away, so a listener is never left behind.

Starting