Log inGet started
World

Blockhaven

Branchmain
Branchesmain
Commite974988fa4

README.md

screen

Blockhaven's two screens, authored as widget trees:

  • the title — BLOCKHAVEN in chunky block lettering (one styled label per letter, so the word cascades in) over the jumping toy avatar and a shower of gold coins, with the tagline pill and one gold PLAY button over the live city;
  • the HUD — the coin count from the pickupsKit ledger and the three outfits of FITZ & CO., each with its price until it is bought and a tick after.

game/screen.module builds the trees and nothing else: Screen.titleTree({ W, H }) and Screen.hudTree({ W, H, coins, delta, ownedCount, owned, outfits }). Every size is worked out from the width the UI lays out on, so the same tree reads at a desktop window and at a phone-sized one.

Screen.build(env) is what scenes/main.scene/build.luau calls. It spawns the ScreenHost entity and attaches game.ScreenHost, the component that registers both screens, polls the ledger and the wardrobe, and answers the PLAY callback — so the engine takes the screens down with that entity.

Coin counts come from require("pickupsKit.api").get(player, "coins"). Outfits owned come from require("game.avatar"): the ids found in its worn table, plus every id that went through its apply(player, id) call — which this component wraps so a purchase shows on the HUD the moment it happens.