Stage 07 — The Arena
You will build: the loop that makes it a game — waves that escalate, a score, player death that matters, instant restart. Plus the consolidation pass that proves the slice is yours. You'll learn: spawners · closing the game loop · honest self-review Warm-up — from memory:
- Your three recorded decisions and the reason for each — no peeking at the doc.
- The damage chain, one more time, now including flash and hitstop: what fires, in order?
Why this exists#
Combat without stakes is a sandbox. The smallest structure that creates stakes: enemies arrive in waves, a number goes up, you can die, and trying again is instant. Roguelites are built on exactly this skeleton; rooms, loot, and progression are modules that bolt onto it later. Today closes the loop; the consolidation half then locks in everything the seven stages built.
Build it#
A — The player can die#
The player's Health has been decorative — make it real: a hearts display on the HUD
(listening to damaged, naturally), a brief post-hit invincibility blink (~0.6s — the
i-frame flag again, third use), and died → the run ends. Getting hit should scare;
tune slime damage until two mistakes hurt and five kill.
B — Waves#
An ArenaController node: spawn wave N (N+2 slimes, mixing your .tres variants),
detect when Enemies is empty (how? — child_exiting_tree, a counter fed by died,
polling get_child_count()... pick with a reason), breathe for two seconds, spawn N+1.
Spawn positions: off-screen edges or marked points — but never inside the player's face
(decide the minimum spawn distance by getting spawned-on once).
C — Score and the end#
Kills score points — later waves worth more, if you like. Death → a results overlay: wave reached, score, best score this session, and one key restarts instantly. Time from death to trying again should be under a second; friction here kills the "one more run" that this whole genre sells.
D — The slice checkpoint (consolidation)#
The overview's definition-of-done, every box, in one sitting. Then the two proofs:
- Rebuild from memory: in a scratch scene, blank script — the Health component, from nothing, working. Compare after. Structure gaps are worth noting; syntax gaps are nothing.
- The out-loud tour: every script file, closed, explained in a sentence each. Any file you can't tour is the file to re-read before calling this done.
E — Choose the next module (and write its plan yourself)#
Stats & leveling · loot · dungeon rooms · ranged enemies · a boss · saving · audio. Pick whichever pulls. As with the farming game: the slice's architecture was handed to you — the module's architecture amendment is yours to draft first, using the existing doc as the model, before any building starts.
git add . && git commit -m "stage 07: waves, score, death & restart — slice complete"
git tag slice-1.0
Checkpoint — definition of done#
- Wave 1 through death through restart, without touching the editor, repeatedly
- Hearts, score, and wave display live and correctly
- Spawns never materialize on top of you; the empty-wave detection has a defended reason
- Both consolidation proofs done, gaps written down
- Overview's full checklist ticked;
slice-1.0tagged - Next module chosen, and its architecture draft started — by you
Stretch (no instructions)#
Between waves, one upgrade choice from two: +1 heart or +10% move speed. Twenty lines, and the RPG in the title stops being aspirational.
Where this leaves you#
Two state machines, three reusable combat components, a data-driven bestiary of one slime and its cousins, juice you tuned by crossing every line, and a loop with stakes. More durable: acceleration curves, telegraphs, buffering, and trauma decay are now your vocabulary — every fast game you play from here on, you'll see the seams. That's not a loss of magic. That's the trade the almanac exists to make.