workshop

← all creations

Closing Doors

mechanics · created 2026-08-24

Threading a shrinking gap on a timer — a closing-gate cycle plus a pure fits-through-the-gap collision test, arcaded into an endless corridor run.

game-feelmovementcanvas

Straphanger’s and Stand Clear’s subway doors — “the aperture’s width is the door-open fraction” — pulled out into its own reusable mechanic: a gate cycles open → closing → closed → opening on a timer, and a probe (the player) either fits through the current opening or gets squeezed back out. The demo arcades it into an endless corridor run: doors ahead cycle on their own clocks, out of sync with each other, and you either rush a wide-open gap or thread dead center right as it’s about to shut. Get caught mid-close and you’re bounced back to wait for the next cycle — streak resets.

Reuse

The mechanic lives in src/closing-doors.js as a framework-free ES module:

Both the cycle and the collision test are pure math with no DOM or canvas dependency — same trick the full subway sims use to stay headlessly testable. Reusable well beyond subways: elevator doors, a portcullis, a closing drawbridge, any hazard that’s dangerous mid-transition and safe at either extreme.

Port notes for DragonRuby: update() is straight state math — translate directly into a tick method; fitsGap translates as-is since it takes plain numbers, not DOM rects.

Gotchas