By Lawrence
5 minutes
5 minutes
Score Across the Top
The score lives in an event stream only you can see.
A view that only listens
A screen that draws the game can do it two ways: reach in and read the game's state, or wait to be told. The HUD waits. It listens to 19 events and its buttons send 7, and nothing else connects it to the game. The director never learns it exists. So the HUD can be deleted, and the game plays on. Its words are pure functions: formatScore(12500) returns "12,500".
Continue reading
Unlock the Full Course
Every lesson, the runnable examples, and the finished build — yours to keep.
$9one-time
=