Log inGet started
World

Anvil Crown

Branchmain
Branchesmain
Commit0c3c8404d1

README.md

deck — the screens of ANVIL CROWN

Every screen the player reads: the title, the how-to-fly card, the column HUD, the pause menu and the two end cards, plus the toasts that call a band change, a Crown phase and an overheat.

local Deck = require("game.interface.deck")

How it runs

The module's top level registers one system with the director:

A.register("ui", { order = 80, build, update, reset })

Order 80 is last in the frame, so every readout is the truth of the frame it is drawn in rather than the previous one. The slice owns no field on A.state; it reads the blackboard and drives A.rules.setPhase out of the title (BEGIN THE CLIMB) and off an end card (FLY AGAIN).

A module's top level only runs when something requires it, so InterfaceHost.component is the scene-side wiring: it requires this module, mounts the screens, and forwards onCallback. Attach it to any entity in the scene and the interface is on.

API

CallWhat it does
Deck.mount()Register and show the screens. The host component calls it; it is also safe to call by hand.
Deck.unmount()Take every screen down and hand the clock back.
Deck.isMounted()Whether the screens are up right now.
Deck.status()A snapshot: mounted, preview, paused, howto, phase, and what is shown.
Deck.preview(key?)Pin one screen on the glass — "title", "howto", "hud", "pause", "ending", "toast". No argument hands visibility back to the phase machine. For stills and the trailer.
Deck.toast(small, big, seconds, colour?, glow?)Put a moment on screen.
Deck.onCallback(id, data)Where every button lands. The host component forwards to it.

Screens

NameLayerUp during
anvil_hud20OPENING · CLIMB · CROWN · RESOLUTION
anvil_toast30a band change, a Crown phase, an overheat
anvil_title40BOOT · TITLE
anvil_howto46opened from the title or the pause menu
anvil_pause52while the pause menu is up
anvil_end56WIN · LOSS

Pause

The pause menu is the only thing in the game that stops the clock: it holds engine.timeScale at 0 while it is up and hands the previous value back the moment it closes. update re-asserts that every frame, so a pause can never outlive its screen.

Reading it

Type, palette, metrics and the box primitives are in .ink; the drawn marks are in .art; the two flank columns are in .hud. Nothing here hard-codes a colour or a face — they come from A.K.PALETTE and A.K.TYPE.