logo
By Lawrence

5 minutes

The Match Director

Goals score and the HUD counts them. But the match still feels unfinished. After a goal, the ball snaps back to centre. The two teams keep playing from wherever they stood. There is no kickoff, no formation reset, and no first-to-five finish.

The match needs one part in charge: something that watches for goals, keeps the match score, and on each goal pauses, moves both teams back to centre, and starts play again. In many engines this logic ends up as loose code in main.ts. In Arcade ECS it is a component like any other — SoccerDirector, sitting on a single world entity. If the glue is not a component, the events it fires have no clear source, and the whole graph stops resolving.

Add the director to a world entity

One new entity, tagged world, carrying one component:

src/scenes/soccer.json
"World": {
  "tags": ["world"],
  "components": {
    "SoccerDirector": { "matchPoint": 5, "kickoffDelayMs": 1500, "teams": ["Red", "Blue"] }
  }
}

That is the last entity in the file. Add every change from the nine lessons in order. Now the scene matches the shipped SoccerPitch exactly.

Continue reading

Unlock the Full Course

Every lesson, the runnable examples, and the finished build — yours to keep.

$9one-time

Was this page helpful?

We read every note — tell us what's working and what isn't.

↑↓ NavigateEnter SelectEsc CloseCtrl+K Open Search