Public: anyone can read this; the crew can change it.

Migrated from github.com/amirmushichge/pixel-plays

Add Harbour Crane: stack crates onto a bobbing boat #18

opened this

Merged 31d 10h ago, live in production

Harbour Crane is added at /harbour-crane/, in the stone-skip pattern. It's in GAMES in shell.js, in the README table, and it has a served-without-a-track test in serve.test.mjs. I haven't played it in a browser or on a touch device.

Notes

opened this

Harbour Crane is added at /harbour-crane/, in the stone-skip pattern. It's in GAMES in shell.js, in the README table, and it has a served-without-a-track test in serve.test.mjs. I haven't played it in a browser or on a touch device. The page's script ran headlessly and I looked at screenshots of the render. The new tests, serve.test.mjs and shell.test.mjs pass; bun x tsc --noEmit and scripts/design-lint.ts were not run. The repo has no src/web/ and I didn't check for a tsconfig.

  • Play: a crate swings on the crane hook and starts at the far left of its swing. Tap, click or space drops it where the hook was. A crate that hangs more than half off what holds it (deck or the crate below) tips sideways into the water and sinks with a splash. Ten crates make a round. The score is crates left on deck, with the best and the crates remaining on the HUD. The swing gets faster with each crate on deck.
  • Boat: it bobs in whole pixels. It sinks a little with each crate, and the stack heels it toward the heavier side.
  • Rules: these live in harbour-crane/crane.js, a plain script with no DOM, so they can be tested. Its tests in crane.test.mjs cover landing, tipping at the half-overhang line, the ten-crate cap, lean and sink, and input clamping.
  • Page: it follows the README visual rules: 360x280 canvas, the shared camera and hard shadows to the right. The quay grass and tree sway stops under prefers-reduced-motion. The canvas aria-label says how to play and the rules popup is three lines. There is a #mute button with synthesised sounds, and no .mp3.

What I left out: the best score lasts only for the page session, as in Stone Skip, and there is no dockhand figure. The boat's bobbing is not stopped under prefers-reduced-motion, because it is part of the game. The lean affects how the boat looks only, not whether a crate stays.

To try it, run bun serve.mjs, open /harbour-crane/ and tap or press space. bun test harbour-crane serve.test.mjs runs the tests.

🤖 Generated with Claude Code

Closes #10

2 earlier comments
commented

Harbour Crane is added at /harbour-crane/, in the stone-skip pattern. It's in GAMES in shell.js, in the README table, and it has a served-without-a-track test in serve.test.mjs. I haven't played it in a browser or on a touch device. The page's script ran headlessly and I looked at screenshots of the render. The new tests, serve.test.mjs and shell.test.mjs pass; bun x tsc --noEmit and scripts/design-lint.ts were not run. The repo has no src/web/ and I didn't check for a tsconfig.

  • Play: a crate swings on the crane hook and starts at the far left of its swing. Tap, click or space drops it where the hook was. A crate that hangs more than half off what holds it (deck or the crate below) tips sideways into the water and sinks with a splash. Ten crates make a round. The score is crates left on deck, with the best and the crates remaining on the HUD. The swing gets faster with each crate on deck.
  • Boat: it bobs in whole pixels. It sinks a little with each crate, and the stack heels it toward the heavier side.
  • Rules: these live in harbour-crane/crane.js, a plain script with no DOM, so they can be tested. Its tests in crane.test.mjs cover landing, tipping at the half-overhang line, the ten-crate cap, lean and sink, and input clamping.
  • Page: it follows the README visual rules: 360x280 canvas, the shared camera and hard shadows to the right. The quay grass and tree sway stops under prefers-reduced-motion. The canvas aria-label says how to play and the rules popup is three lines. There is a #mute button with synthesised sounds, and no .mp3.

What I left out: the best score lasts only for the page session, as in Stone Skip, and there is no dockhand figure. The boat's bobbing is not stopped under prefers-reduced-motion, because it is part of the game. The lean affects how the boat looks only, not whether a crate stays.

To try it, run bun serve.mjs, open /harbour-crane/ and tap or press space. bun test harbour-crane serve.test.mjs runs the tests.

🤖 Generated with Claude Code

commented

I merged main into the branch, resolved the conflicts in README.md and shell.js, and pushed. The full bun test passes (56 tests); I haven't seen the forge's check on this push yet.

  • shell.js: main now gives every GAMES entry a one-line blurb, so I took its list and added Harbour Crane with the blurb "Stack ten crates onto a bobbing fishing boat from a swinging crane hook".
  • README.md: I kept main's new "Add a game" text and re-added Harbour Crane to its list of games that play their own sound effects instead of a track.
  • index.html: this wasn't in the conflict list, but main now keeps a no-JS fallback list that serve.test.mjs checks against GAMES. I added a matching Harbour Crane entry, since the merge would have failed that check without it.
commented

All five points are fixed and pushed. The harbour-crane, serve and shell tests pass (24). I haven't re-run the page headlessly or in a browser, only checked that its script still compiles, and bun x tsc --noEmit was not run.

  1. Stack on a leaning boat: crane.js now has stackBase(crates, i, x, deckAt). The first crate sits on the deck at its own x, and every later crate sits on the one below, so the stack no longer floats or sinks. The page uses it for landed crates, the falling crate and the tipping crate. The new test uses a sloped deck and checks that each crate's base is the base of the crate below plus CRATE_H. It would have failed under the old per-crate heel, though I didn't run it against the old code.
  2. G.hooked: removed.
  3. beam(): removed, and the crane parts now call box directly.
  4. point sound: G.raised is set only when a crate lifts the best, and cleared on restart. A round that only ties the old best no longer plays point.
  5. Tip rule: it is now Math.abs(at - centre) > half, with the comment "tips when its middle is past the edge of what holds it". New tests cover both deck edges: x = ±DECK_HALF stays, and ±(DECK_HALF + .01) tips.

I didn't disagree with any of it.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs