Log inGet started
World

First Light: Crowfeet

Branchmain
Branchesmain
Commit0f27cfd84c

README.md

CF

The blackboard of First Light: Crowfeet. One module every part of the game requires:

local CF = require("game.CF")

What is in it

CF.RULESevery number the game is tuned by
CF.PALETTEthe colours everything composes to
CF.FILMEDthe shape the run films at (1080x1440)
CF.layoutthe cliff: ledges, food, summitY, top, halfWidth, apex
CF.statewhat is true right now
CF.landing / CF.grabbablethe two ledging tests
CF.on / CF.off / CF.emitthe event bus
CF.setPhase / CF.reset / CF.say / CF.progress / CF.sz
CF.camerafilled in by the camera: panTo zoomTo release kick

The cliff

CF.layout.ledges is 28 shelves from the strand at y 0 to the roost at summitY, each { id, x, y, w, kind, fallen } with kind one of strand rock crumble roost. A shelf's TOP is at y and it spans x ± w/2. CF.layout.food is { id, ledge, kind, x, y, eaten } with kind one of grub limpet crowfoot. It is built deterministically, so every peer and every slice sees the same cliff.

Two numbers shape it. CF.layout.apex is how high one hop rises. Every SHORT gap is under it and is landed on; every TALL gap is over it, so the only way up is to catch the lip. And the shelf above a crumble shelf is placed back over the shelf below it, so a crumble that has given way never seals the climb.

The two ledging tests

  • CF.landing(x, yFrom, yTo) — the shelf whose top the crow's feet crossed going down this frame, highest first. Returns nil, or the ledge.
  • CF.grabbable(x, feetY, facing) — the shelf whose near lip is within reach of an airborne crow's crown, in the direction it is facing. Returns nil, or the ledge and the x of that lip.

Both ignore a shelf whose fallen is set.

The state

phase (title opening climb won lost) · hunger · dawn 0..1 · time · crow { x, y, vx, vy, facing, grounded, hanging, ledge } · altitude · eaten · hops · crumbled · lostReason (starved sea late) · paused.

The climb slice writes it; everyone else reads it. CF.reset() puts a round back — the state, the food and the fallen shelves — and restart is answered here, so a round can always be put back.

The events

start restart reset phase pause · hop land grab pullup drop peck eat tooWeak crumble crumbled fall · hungerLow firstLight · line ui.

crumble fires when the crow's weight first lands on a crumble shelf, and it has RULES.crumbleDelay left to stand. crumbled fires when it goes.

Laying out for any screen

CF.sz(fraction) is a fraction of the SHORTER screen edge, read live from ui.screenSize(), so one number lays out the same on a phone held either way and on a television.