▣
module · drop-in viewer
camera
The one thing that moves `FightCamera`. Registered as `Bus.services.camera`.
by·posted 2mo ago
What it does
staging.camera
The one thing that moves FightCamera. Registered as Bus.services.camera.
The camera is orthographic and never rotates. Everything it does is three numbers: where it sits on x, where it sits on y, and how much world height it shows (3.4 at its closest, 5.6 when the fighters are at the walls).
Bus.call("camera", "follow", p1.x, p2.x) -- the fight's resting behaviour
Bus.call("camera", "focus", x, y, 1.8, 20) -- take it away for a beat
Bus.call("camera", "hold", 90, 40) -- ...and give it back on its own
Bus.call("camera", "shake", 0.4)
follow(x1, x2)keeps both fighters in frame with a margin and widens as they separate. Call it every frame; it is smoothed, not snapped.focus(x, y, zoom, frames)overridesfollowfor a staged beat.hold(frames, releaseFrames)hands the camera back on its own, so a missedreleasecan never strand the view.shake(mag)is trauma-based: additive, decaying, and squared, so a small value really is small.impulse(dx, dy, tilt)shoves the frame once and lets it spring back — that is what makes a heavy read as a heavy rather than as more shake.lock()/unlock()— while the lock is held,followis ignored. The attract sequence holds it, because a combat slice callingfollowevery frame otherwise wins the argument against every staged shot.set/snapplace the camera absolutely, for beats with no fighters.
The result is mirrored into Bus.state.camera (x, y, zoom, height,
shakeX, shakeY) every frame, so any slice can read the framing without
touching the entity.
Discussion
Scoped to this part · feeds back into the world's score.
Sign in to post.sign in
No comments yet. Be the first.