Nine Bells
README.md
Camera2D — the camera of Ashcross
The only camera in Nine Bells. Orthographic, side-on, never rotating, never
leaving the NB.CAMERA.z plane; it looks straight down -Z at a flat city on a
1080x1440 portrait screen, which covers sixteen world units vertically and only
twelve across.
In play
It follows NB.state.doctor — not an entity, because the traverse slice runs its
own 2D physics and writes the doctor's position into the blackboard. There is a
deadzone the doctor moves inside without the camera answering (narrow
horizontally, because there is almost no horizontal room to give away), a lead in
the direction of travel scaled by run speed, and a softer vertical time constant
so a landing reads as weight. It publishes where it ended up into
NB.state.cameraX / cameraY, which is what the backdrop reads for its scripted
parallax and what every slice reads to decide whether a thing is on screen.
When a moment takes it
| Call | What it does |
|---|---|
:panTo(x, y, seconds, ease) | a TIMED move along an eased curve; :isPanning() says when it has arrived |
:zoomTo(height, seconds, ease) | a TIMED change of lens. 16 is the playing frame, 10 a push onto a face, 22 the district opening out |
:setDrift(vx, vy) | a slow creep added to a driven shot — a held frame that drifts is alive, one that is nailed down is a still |
:kick(amount) | the shake: a bell, a hard landing, a floor giving way |
:snapTo(x, y) | a cut. Take the override too (:driveTo) or the follow walks it straight back |
:driveTo(x, y) | the untimed, damped drive |
:release() | hand the shot back to the doctor, cancelling any pan and drift |
:setBounds(minX, maxX, minY, maxY) | the city slice's limits on the FOLLOW. A driven shot ignores them: a staged moment may look above the roofline |
:pose() | where the shot is, with the shake taken back out |
Ease names: linear inQuad outQuad inOutQuad outCubic inOutCubic
inOutSine outExpo.
It also carries the staging clock
game.stage installs NB.ext.stageTick and NB.ext.stagePostTick; this
component calls them once a frame, in edit mode as well as in play, so a moment
can be rehearsed without entering play and locking the VFS for the other slices.
The pre-tick runs before the pose, so a cue that starts a pan this frame is
answered this frame; the post-tick runs after it, which is where anything held in
front of the lens is placed so it never lags the shake. Both calls are guarded: a
staging module mid-edit can never take the camera down with it.
Usage
rig.component.add("Camera", {
projection = "orthographic",
behavior = asset.resolve("game.Camera2D", "component"),
})
Owned by the staging slice. See /zero/source/design/spec.md.