Add Flock Dash, the thirteenth Activities game, with sounds and music

AI Assisted
This commit is contained in:
jparkerweb committed 2026-11-05 07:57:21 -08:00
1 parent e924cf5cde
commit 6376a68f85
20 files changed
+4218 -31

No files matched your search

+5 -4
View File
@@ -246,7 +246,7 @@ Optional local browser UI shipped with **every** skill. Source lives in `src/web
| `spec-files.mjs` | no imports: how a spec's markdown files are read, `MARKERS`, `TASK_LINE_RE`, `TASK_ID_RE`, `CHECKBOX_RE`, `STATUS_RE`, `statusOf()` and `countTasks()`; shared by `scan.mjs`, `patches.mjs` and `src/skill-scripts/specs.mjs` (through `consoleModule()`) |
| `static.mjs` | serving the page's own files: `SERVABLE` (the allow-list), `TYPES`, caching and ETags, the accent colors, and `CSS_ORDER` + `joinedStyles()`, the one place the cascade order is stated |
| `workspace.mjs` | the session's extra folders, and the folders remembered per project and spec |
| `public/activities.js` | the list of activities (`ACTIVITIES`: each game's id, title, picker card line `blurb` and module path) an optional `courses` list (Mini golf's six course ids, which open a course dashboard), `bestKey(id, course?)`, the flat looks.json key for its best score (`activityBestSnake`, one per golf course `activityBestGolfPirate` to `activityBestGolfFrost`, `activityBestTrails`, `activityBestBugs`, `activityBestDrive`, `activityBestStack`, `activityBestBumper`, `activityBestRapids`, `activityBestFuse`, `activityBestHop`, `activityBestBounce`, `activityBestGhoul`); lists Snake, Mini golf, Light Trails, Bug Hunt, Sunset Drive, Stack Deploy, Bumper Ring, Rapids Run, Hot Potato, Crossing Rush, Bounce Road and Ghoul Rush, `bestKeys(entry)`, every best key a game keeps, and documents the game contract including the course parts (`courses` and `preview()` on the export, `setCourse()` and `course` on the game), the optional `pointer(type, x, y)`, `release(name)` (a game key let go) and `lowerIsBetter`; data only, imported by the page and by Node |
| `public/activities.js` | the list of activities (`ACTIVITIES`: each game's id, title, picker card line `blurb` and module path) an optional `courses` list (Mini golf's six course ids, which open a course dashboard), `bestKey(id, course?)`, the flat looks.json key for its best score (`activityBestSnake`, one per golf course `activityBestGolfPirate` to `activityBestGolfFrost`, `activityBestTrails`, `activityBestBugs`, `activityBestDrive`, `activityBestStack`, `activityBestBumper`, `activityBestRapids`, `activityBestFuse`, `activityBestHop`, `activityBestBounce`, `activityBestGhoul`, `activityBestFlock`); lists Snake, Mini golf, Light Trails, Bug Hunt, Sunset Drive, Stack Deploy, Bumper Ring, Rapids Run, Hot Potato, Crossing Rush, Bounce Road, Ghoul Rush and Flock Dash, `bestKeys(entry)`, every best key a game keeps, and documents the game contract including the course parts (`courses` and `preview()` on the export, `setCourse()` and `course` on the game), the optional `pointer(type, x, y)`, `release(name)` (a game key let go) and `lowerIsBetter`; data only, imported by the page and by Node |
| `public/activities/snake.js` | Snake: its rules as plain exported functions and the game contract (`create({ canvas, tone, onScore })` returning `start`, `pause`, `resume`, `key`, `tick`, `resize`, `score`, `state`); it never runs a timer or listens for keys, so the Activities window drives it; it also holds the music's rules: `MUSIC_TRACKS`, `dealMusic(random, last)` (a round's shuffle of the ten tracks, never opening on the last round's opener), `trackFor(deck, level)` and `heat(round)` (the snake's speed as 0.3 to 1, so the lead and drums are in from the first step) |
| `public/activities/trails.js` | Light Trails: its rules as plain exported functions (`newRound`, `newHeat`, `turn`, `boost`, `advance` in 8 ms slices (where your crash is held for `GRACE_MS`, a turn in that time riding out of it; rivals get no grace), `choose` and `room` for the rivals' flood-fill steering, `applyPower` (a Mystery becoming another pad), `pickPower` (by each pad's `from` arena, a Heart only under `MAX_LIVES`), `fireLaser`, `hyperjump`, `awardLives` (a life every `LIFE_SCORE` points, the mark moving on at the cap), `spawnItem`, `closeRing`), the `ARENAS` (rivals, sharpness and what each adds), the `POWERS` pads (Boost, Phase, Eraser, Slow-mo, Coin, Heart, Shield held across heats until a crash in your grace pops it, Laser with `LASER_SHOTS`, Score x2 through one `gain()` every score goes through, Wide Trail with its side cells in `rider.wide`, Coin Rain whose `rain` coins never hold back a pad, Hyperjump, Mystery) and the game contract; `START_LIVES` is 5; memo is the furthest arena reached; a read-only `round` getter for the tests only; it also holds the music's rules: `MUSIC_TRACKS` (its five songs) and `dealMusic(random, last)` (a shuffle of them, never opening on `last`); a run plays the deal one song after another, each in full from the top (asking with `{ restart: true }` until the music takes it), moves on when `music()` answers `"ended"`, deals again after the last, and a new run deals afresh, never opening on the song the last run was playing; its tones and hums play `SFX_LOUDER` times as loud through tones.js's `louder`, all but the engine drones (`DRONES`), kept low under the songs |
| `public/activities/bugs.js` | Bug Hunt: its rules as plain exported functions (`newRound`, `spawnWave`, `slotPos`, `advance` in 8 ms slices over `round.input`, which `key()` and `release()` set, `hurtBug`, `hurtBoss`, `hitShip`, `applyPower`, `ghostly`, `tentacleTip`, `bossRadius`), the `BUGS` by first wave, the `BOSSES` every `BOSS_EVERY` waves, the `POWERS`, the `SECTORS` scenery and the game contract with `release()`; memo is the tally of `DISCOVERIES` as bits; a read-only `round` getter for the tests only |
@@ -256,8 +256,8 @@ Optional local browser UI shipped with **every** skill. Source lives in `src/web
| `public/activities/bumper-draw.js` | Bumper Ring's drawing: `drawScene(ctx, view)` from a plain view `bumper.js` builds (the round, the board geometry, the effects, the pill numbers), each arena's ring in its fixed palette (`themeFor`), the floor (ice, oil, holes, bumpers, the magnet, the warning bands), the cars (Planny upright at the wheel of a car in `--accent`, star eye and stick arms; rivals with a face each), the pills (laid out by `hudLayout`, which starts a row below rather than run into the ring's countdown or off the board), banners and the start and end strip, and `readColors(canvas)`; decides nothing |
| `public/activities/rapids.js` | Rapids Run: its rules as plain exported functions over a round on a river scrolling down a 64 unit wide field, 84 units of it on the board (`newRound(seed)`, `newRiver(seed)`, `buildStretch(river, n, random)` (a stretch's rows from its own seed, each row a center, width and island width: a calm opening, then drifts, narrows and islands, every bank slanting at most `SLOPE` a unit, every channel at least `MIN_CHANNEL` wide, then a `BASIN_W` basin on a boss stretch and the narrowing to the `DAM_W` dam; and its plan of foes, buoys and crates, none in the first `SAFE_START` (where you start again) or by the dam), `ensureRiver`, `riverAt` (a row's banks and island eased from the row before's, so they slant as drawn), `channelsAt`, `channelAt`, `isWater`, `onLand` (the hull sampled at seven points), `placeAt` (the start of a stretch, its dam whole and its plan loaded afresh), `advance` in 4 ms slices over `round.input`, which `key()` and `release()` set: steering eased in, the whirlpools' tug, the speed held (up, down or neither, times the stretch's `pace`), the battery drained (`DRAIN` a second cruising, more at speed), distance points, the guns (`FIRE_MS`, Spread's fan), shots against foes, the boss, the dam and buoys, the foes (skiffs and darters drift and turn at the banks, a darter swerves into your lane, gulls take off as you near and swoop across, sentries fire at you), the boss (`spawnBoss` holds the river and the battery; its volleys by kind), bolts, pickups (a buoy `BUOY_CHARGE`, the magnet's pull, crates), crashes (`lose`: a shield takes any crash but a flat battery and slides you off a bank; blinking for `GRACE_MS` after a restart), skims (`SKIM_POINTS` each `SKIM_MS` closer than `SKIM_GAP` at speed), the dam (`hitDam`, then past it the next stretch, with `FLAWLESS_POINTS` times it for no life lost), `hurtFoe` (the combo, up to `MAX_COMBO`), `hurtBoss` (a life back and a crate), `applyPower`, `stretchFor` (built once a stretch; past the eighth, Night Water 2, 3 and on), `underBanner`, `screenY`, `seeded`), the `FOES`, `BOSSES`, `POWERS` and `STRETCHES`, and the game contract with `release()` (held arrows steer, speed and slow, held space fires; a pause lets go of every key); memo is the furthest dam blasted, which can pass 8; a read-only `round` getter for the tests only. Tuned by a scratch sim: a careful bot clears a stretch in 20 to 35 seconds, and the battery runs flat for one that grabs too few buoys |
| `public/activities/rapids-draw.js` | Rapids Run's drawing: `drawScene(ctx, view)` from one view object `rapids.js` refills each frame, in field units: the strip above the field in the page's colors with the pills (laid out by `hudLayout`, which starts a second row rather than run off the board and centers its rows in the strip), the river a look at a time (`LOOKS`: meadow, autumn, canyon, marsh, dusk and night, each in fixed colors, the look changing at each dam): banded banks, the water between them with shore lines and flow streaks carried downstream by the view's clock, pointed islands, trees or rocks; the dam ahead (hazard stripes, a crack for every share knocked out, a trickle once it is close to going) and the broken one behind; charge buoys, crates with their glyphs, whirlpools, skiffs, darters, mines, bank sentries aiming at you and gull drones with their shadows; the mini-boss and its health bar; Planny's jet-skimmer in your highlight with a white trim (so a blue highlight still shows on blue water), his wake, jets, arms to the bars (up when a dam or a boss goes), his box and his star eye in your highlight, bobbing with the star spinning after a crash; shots, bolts, sparks, rings, floating words (kept on the field by `labelSpot`), the combo's big number, the battery gauge beside the field (green, amber, then red and blinking under the low mark), banners, and the start and end strip with the big final score and a dot per named stretch whose dam you have blasted; `readColors(canvas)`, `lookColor`, `inkOn`, `contrast`; decides nothing |
| `public/activities/flock.js` | Flock Dash: its rules as plain exported functions over a round (`newRound(seed)`, `steer`, `recordPath`, `placeFlock`, `screenX`, `collect`, `spawnStrays`, `advance`) and the game contract. The flock is a recorded path with running arc length: follower k sits `k * SPACING` behind the leader along it. |
| `public/activities/flock-draw.js` | Flock Dash's drawing: `drawScene(ctx, view)` and `hudLayout` from one view object `flock.js` refills each frame, in field units: the sunset sky, the strays, the flock, Planny as the lead bird with a star for an eye, and the pills. |
| `public/activities/flock.js` | Flock Dash: its rules as plain exported functions over a round scrolling right to left over a 96 by 54 unit field (`newRound(seed)`, `steer` (the leader eased up and down inside the `BAND_MIN` to `BAND_MAX` band at the left), `recordPath`, `placeFlock`, `screenX`, `collect` and `spawnStrays` (a stray joins the flock, the combo up to `MAX_COMBO` within `COMBO_MS`), `buildStage(seed, n)` (a stage's hazards by distance from its own seed, a clear `SAFE_START` and `SAFE_END`, and `clearGap` keeping a way through), `moveHazards`, `hazardHits`, `snapAt` (a snap drops the birds behind the one hit, `scattered` for `SCATTER_MS` so they can be picked up again), `hitLeader` (a life, or a shield; `GRACE_MS` after), `reachPortal` (the jet stream portal, the V of `V_POINTS` a bird when the flock has `min`, `FLAWLESS_POINTS` for no snap or life lost, and the final portal that sways), `applyPower` (crates: tailwind, shield up to `MAX_SHIELDS`, magnet), `banner`, `bannerRow`, `underBanner`, `advance` in `SLICE_MS` slices, `teaser`, `seeded`, `dealMusic`), the `STAGES` table (eight stages, each with its speed, length, stray gap, portal `min`, hazard weights and gap; the place to tune the difficulty), the `HAZARDS` (balloon, gust, stream, cluster, storm, kite, each from its own stage) and `POWERS`, and the game contract with `release()` (held arrows steer, a pause lets go of every key); the round also carries `events` (what the draw and the sounds react to) and `warned` (one gust or storm warning each); memo is the furthest stage reached. The flock is a recorded path with running arc length: follower k sits `k * SPACING` behind the leader along it, so it copies every turn at any speed. `MUSIC_TRACKS` names the five songs, dealt afresh each round |
| `public/activities/flock-draw.js` | Flock Dash's drawing: `drawScene(ctx, view)` and `hudLayout` from one view object `flock.js` refills each frame, in field units: the sunset sky (`SKIES`, one palette per stage: the sun sinking, clouds, a rim light from stage 6 and stars on the last), the hazards (balloons and bunches, the head-wind's warning band and gust, slipstreams, thunderheads with their flash and bolt, kites on their strings), the strays and scattered birds, the flock, Planny as the lead bird with a star for an eye, crates and the magnet ring, the tailwind streaks, the portal and the V, the pills (laid out by `hudLayout`, which shrinks them to fit the board), banners, and the end strip with the final score, the best and the teaser; `readColors(canvas)`; decides nothing |
| `public/activities/fuse.js` | Hot Potato: its rules as plain exported functions over a round on a 104 by 70 arena (`newRound`, `newMatch(round, venue)`, which lights each bomb on a rival, never you, in a match's first fuse, `advance` in 8 ms slices over `round.input`, which `key()` and `release()` set, `move` (speed eased toward the held direction at `GRIP`, a dash holding its line, belts and ice from the floor), `dash` (a holder's dash is a numbered lunge), `tag` (a holder touching a runner with no bomb passes it, never inside `NO_TAGBACK_MS` of the bomb changing hands, nor back to the one who just passed it within `TAGBACK_MS` while three or more are left, `tagBack`, with `tagSafe` saying who is safe that way for the drawing; a fuse under `PASS_FLOOR_MS`, `NO_TAGBACK_MS` plus `PASS_REACT_MS`, is raised to it on any pass, once a fuse for each runner (`bomb.lifted`); your pass scores, a hot one under `HOT_MS` as passed steps the streak), `burn` (Freeze takes its share first), `blast` (the holder out, everyone near knocked back, the match over when that was you or one is left), `nextFuse` (a survivor with no bomb, the next shorter fuse from `fuseFor`, never more bombs than one for every two left), `think` (a holder chases by its own flood-fill path, weighted toward a boxed-in or dashless target; a runner without a bomb scores candidate spots by the holders' path distance against its own and flees to the best; personalities bend both), `applyPower`, `spawnPickup`, `speedOf`, `clearLine`, `rivalPower` and `venueFor` (each built once per venue), `rivalColors(you)`), the `VENUES`, `LAYOUTS`, `RIVALS` and `POWERS`, and the game contract with `release()` (`key(name, repeat)` never dashes on a repeat); a rival holder winds up (`WINDUP_MS`, shorter when sharp) or, a Trickster, feints (`FAKE_MS`) before a lunge, and a runner a lunge comes at dodges once a lunge at its venue's odds after its reaction time; the fuse ticks quicker and higher as it burns down, on one clock however many bombs burn (yours, else the shortest); a bomb whose fuse has run out passes to nobody; memo is the furthest venue reached, which can pass 9; a read-only `round` getter for the tests only. Tuned by a scratch sim (see "As built" in `game-ideas/hot-potato.md`) |
| `public/activities/fuse-draw.js` | Hot Potato's drawing: `drawScene(ctx, view)` from one view object `fuse.js` refills each frame, in arena units: the strip above the arena in the page's colors with the pills (laid out by `hudLayout`, which starts a second row rather than run into the fuse and centers its rows in the strip), each venue's floor in its fixed palette (`themeFor`, `venueColor`), ice, running belts, the Rooftop's open edge, the things to run round, pickups, the runners (Planny on his feet with his star eye and stick arms, flailing while he holds a bomb, and still Planny when charred; arms and feet on the floor in `limbInk(level)`, the ink that stands out from that venue's tiles; rivals with a mark per personality; a white ring with a dark edge at the feet of a runner safe from a tag-back; the charred waddle to the nearest wall and the fall from the roof), the bomb over its holder (a red ball with a `<<<` band, growing and glowing as it burns, flashing white while it cannot be passed, its fuse a shortening curl with a spark, the last seconds in big numbers (under the holder's feet when there is no room above, `countY`), a hop across on a pass), blast clouds, the Blackout's dark worked out once a frame in cells, the red edge pulse in a fuse's last second, banners and the start and end strip with the big final score, and `readColors(canvas)`; decides nothing |
| `public/activities/hop.js` | Crossing Rush: its rules as plain exported functions over a round on a strip `COLS` (11) cells wide of 30 to 40 lanes, `VIEW_ROWS` (14) on the board at once (`newRound`, `newHeat(round, zone)`, which builds the heat's lanes from the round's seed, kept when a heat runs again, `buildLanes(zone, seed)` (groups of road, highway, ice, river, turtle, rapids or rail lanes with a grass row between each two, the zone's new thing first; the same seed builds the same lanes), `advance` in 8 ms slices (lanes flow, riders drift with their log, rivals choose, everyone is checked where they stand before any hop moves on, then hops and flights; hoppers home in the same slice finish by the moment each landed, a dead heat to you), `hop(round, hopper, dir)` (one cell, two with a Spring; a hopper counts in the cell it leaves for the first half and the one it lands on for the second; an icy lane slides it a cell more), `laneAt`, `occupied(round, row, col, atMs)` (a car or a train on it, or in a river no float or the edge, `atMs` ahead through `shiftAt`, which follows a lane's flips, surges and a Horn exactly), `sendBack` (to the last grass row, `safeBelow`, crediting a shove within `SHOVE_CREDIT_MS`), `shove(round, from, to)` (a cell the way `from` faces, only on a hopper `inReach` and never on one past the half of its hop home, once every `SHOVE_MS`), `plan(round, hopper, random, power)` (a look ahead of `LOOKAHEAD` to `LOOKAHEAD_SHARP` hops over the lanes as they will move, each hop followed by the hopper's wait where it lands; never a hop where it would be hit or fall in at full sharpness; a sloppy rival now and then hops on regardless), `applyPower`, `zoneFor` and `rivalPower` (each built once per zone), `rivalColors(you)`, `standings`), the `ZONES`, `RIVALS` and `POWERS`, and the game contract with `release()` (`key(name, repeat)` hops once a press: never on a repeat, never again until the arrow is let go, never with the press that plays on, and with one hop queued behind the one in the air; a pause drops what is held and the queue); rivals wait `REACT_MS` down to a sharp rival's after each landing, a Bruiser shoves anyone beside it into a lane, a Tagalong follows a row behind you and shoves near the top, and a rival that lets a shove go weighs the next one only after `SHOVE_LOOK_MS`; memo is the furthest zone reached, which can pass 9; a read-only `round` getter for the tests only. Tuned by a scratch sim (see "As built" in `game-ideas/crossing-rush.md`) |
@@ -450,9 +450,10 @@ Optional local browser UI shipped with **every** skill. Source lives in `src/web
| `public/state.js` | the page's shared state (`page.S` the server's truth, `page.local` what is staged) and the `redraw()` / save hooks every screen calls; defines only |
| `public/tones.js` | the activities' sound engine, all synthesized in the browser. Three parts: a shared kit of rich one-shot sounds (`RICH`: `layers` of parts played together, each a wave or a noise (`noise`, `pink`, `brown`) with its own `delay`, `gain`, `attack`, a sweeping `filter` and `vibrato`: `explode`, `smash`, `skid`, `whoosh`, `splashBig`, `fanfare`, `gameOver` and some fifty more, up to 1.2 s, at most `MAX_VOICES` parts sounding at once), held **hums** (`hum(id, name, level, pitch)`, called every frame a game wants it: oscillators and noise through one filter that follows the pitch, pulsed for an engine's strokes; a hum not asked for within `HUM_HOLD_MS` fades by itself, so a paused or closed game goes quiet without saying so, `hushTones()` quiets every one and the Activities window calls it whenever it stops ticking; at most `MAX_HUMS`; shared ones `car`, `toycar`, `electric`, `outboard`, `river`, `wind`, `cycle`, `fuse`, `haunt`, `squeal`, `meter`, `swarm`, `train`, `crowd`), and each game's own extras in `public/activities/<id>-sfx.js` (`{ tones, hums }`, plain objects, names prefixed with the game id, merged and frozen here; a name may be defined once across all of them, which `scripts/test-web-console-tones.mjs` checks along with every spec's shape and every name a game's source asks for). Everything plays through one compressor. The older single blips (`BLIPS`): `tone(name, level, pitch)` with an optional loudness from 0 to 1 and an optional pitch that scales every frequency, kept between 0.25 and 4, and an optional fourth `louder` (a game lifting its sounds as a whole, up to `LOUDER_MAX`, also the fifth argument of `hum()`), `unlockTones()`; Snake's blips plus golf's `putt`, `wall`, `bump`, `cup`, `ace` (a three-note rise), `splash`, `power` (a power-up, three notes), `tunnel`, `boom` (a cannon putt), `sizzle` (lava) and `fall` (the pit), the countdown's `count` and `go`, Stack Deploy's `thunk`, `slice` and `perfect`, which it pitches up a scale step for each perfect in a row, and Bumper Ring's `ram`, pitched and leveled by how hard the hit, and `rev`, a rival winding up a dash, and Hot Potato's `tick`, the fuse, which it ticks quicker and pitches higher as the fuse burns down, and `pop`, a pass, and Crossing Rush's `hop`, which it pitches up a step for each quick hop forward in a row, `boing`, a send-back, `bell`, a train coming, and `horn`, and Bounce Road's `engine`, a soft low triangle hum it plays every few frames while you pick up speed (quiet once you cruise or coast), pitched up with your speed, `spring`, a jump, pitched with your speed, and `squash`, a rival flattened, pitched up a step for each in a chain, and `beat`, a low thump while your wheels run on the verge (it borrows the other games' blips for its hazards and rivals), and Rapids Run's `pew` (a shot, a short soft triangle played quietly about seven times a second while fire is held), `charge` (a buoy taken), `lowcell` (the low battery's two-note beep, quicker the lower it runs), `dambreak` (a dam bursting) and `skim` (a bank skimmed at speed, pitched up the more you have skimmed), and Ghoul Rush's `ghoulBlast` (the blaster's bolt, a short soft triangle repeated while fire is held), `zombiePop` (a kill, pitched up a step for each in the chain), `ghoulStomp`, `ghoulBoo`, `ghoulRoar` and `zombieGroan` (now kept for the other games and the tests: Ghoul Rush's monsters speak with their own voices from `ghoul-sfx.js`), `ghoulCandy` (pitched up for candy in quick succession), `batSwoop` (a bat's kill), `doorUnlock` (the key), `doorThrough` (the door to the next room) and `creakBoard` (a crawler coming up, a chandelier or a crumbling board about to go), all soft triangles and sines), silent while Play sounds is off; separate from `sound.js`'s cue queue |
| `public/music.js` | the games' chiptune music: a small sequencer over `tones.js`'s context and compressor (`audioOut()`). A game calls `music(name, intensity)` from its `tick`; the track fades out within `MUSIC_HOLD_MS` once it stops being asked for, picks up again on the bar it left, asking for a different track crossfades the two over `CROSSFADE_S` (the old one keeps playing as it fades, so a new level is not a cut), and `hushMusic()` stops it at once. Tracks are note data under `music` in each game's `activities/<id>-sfx.js` (`{ bpm, rush, bar, voices, patterns, order }`, `bar` the steps in a bar when it is not 16, so the track resumes on a bar start and each pattern is whole bars: pulse, triangle and noise-drum voices, each joining once the intensity reaches its `from`; a step a token, `A4`, `-` to hold, `.` a rest, `A3^037` an arpeggio, drums `k s h o`), read by `compileTrack()` and booked `LOOKAHEAD_S` ahead on the audio clock. It also plays recorded **songs**: mp3s a game names under `songs` in its sfx file (a name to a served path, merged by `tones.js` as `SONG_TABLES`, listed by `songNames()`), asked for the same way, one `<audio>` element each made on first use, at `SONG_PEAK` times the volume, faded over `SONG_FADE_MS`; a song plays once, never looped, `music()` returning `"playing"` or `"ended"` (which the window's wrapper passes back to the game), `{ restart: true }` taking it back to the top with `load()` (no seeking, since the server sends no byte ranges), and a song no longer asked for fades and pauses where it was. The window plays it only while Play sounds, Play game sounds and Play game music (`looks.gameMusic`, off by default) are all on |
| `public/activities/snake-sfx.js` · `public/activities/flock-sfx.js` · `public/activities/golf-sfx.js` · `public/activities/trails-sfx.js` · `public/activities/bugs-sfx.js` · `public/activities/drive-sfx.js` · `public/activities/stack-sfx.js` · `public/activities/bumper-sfx.js` · `public/activities/rapids-sfx.js` · `public/activities/fuse-sfx.js` · `public/activities/hop-sfx.js` · `public/activities/bounce-sfx.js` · `public/activities/ghoul-rush/sfx/ghoul-sfx.js` | each game's own sound effects as data, `{ tones, hums }` in the shapes `tones.js` documents, every name prefixed with the game id (`driveEngine`, `ghoulMoan`), merged and frozen by `tones.js`; no imports, but for `ghoul-sfx.js`, which merges each Ghoul Rush stage's own `ghoul-sfx-<stage>.js` into its `tones`, `hums` and `music`, and `snake-sfx.js`, which merges `snake-music.js` as its `music`; `trails-sfx.js` has `songs` instead of `music` |
| `public/activities/snake-sfx.js` · `public/activities/flock-sfx.js` · `public/activities/golf-sfx.js` · `public/activities/trails-sfx.js` · `public/activities/bugs-sfx.js` · `public/activities/drive-sfx.js` · `public/activities/stack-sfx.js` · `public/activities/bumper-sfx.js` · `public/activities/rapids-sfx.js` · `public/activities/fuse-sfx.js` · `public/activities/hop-sfx.js` · `public/activities/bounce-sfx.js` · `public/activities/ghoul-rush/sfx/ghoul-sfx.js` | each game's own sound effects as data, `{ tones, hums }` in the shapes `tones.js` documents, every name prefixed with the game id (`driveEngine`, `ghoulMoan`), merged and frozen by `tones.js`; no imports, but for `ghoul-sfx.js`, which merges each Ghoul Rush stage's own `ghoul-sfx-<stage>.js` into its `tones`, `hums` and `music`, and `snake-sfx.js`, which merges `snake-music.js` as its `music`; `trails-sfx.js` and `flock-sfx.js` have `songs` instead of `music` |
| `public/activities/snake-music.js` | Snake's ten music tracks as data (no imports): `SNAKE_MUSIC`, `{ bpm, rush, voices, patterns, order }` each, named `snake<Place>` and listed in `MUSIC_TRACKS` in `snake.js`. A round deals them in a fresh order, one to each level, so a run hears a different track at every level and none twice. They were picked on the pages in `prototypes/music/snake` (rhythm-first folk and world tunes led by something plucked or reedy, mostly dark or modal), and their bars are not all sixteen steps: 6/8 is 12, 7/8 is 14, ten beats is 20, twelve beats is 24, each pattern a whole number of its bars; merged by `snake-sfx.js` |
| `public/activities/light-trails/1.mp3` to `5.mp3` | Light Trails' five background songs, named `trailsSong1` to `trailsSong5` under `songs` in `trails-sfx.js` and listed in `SERVABLE`; re-encoded for size with ffmpeg (80 kbps stereo MP3 at 44.1 kHz, loudness-normalized to -16 LUFS with `loudnorm`, metadata stripped), about 7.6 MB together, and copied into every skill with the rest of the console. The server leaves them out of its start-up cache warm |
| `public/activities/flock-dash/1.mp3` to `5.mp3` | Flock Dash's five background songs, named `flockSong1` to `flockSong5` under `songs` in `flock-sfx.js` and listed in `SERVABLE`; re-encoded for size with ffmpeg the way Light Trails' were (80 kbps stereo MP3 at 44.1 kHz, loudness-normalized to -16 LUFS with `loudnorm`, metadata stripped), about 6.4 MB together, and copied into every skill with the rest of the console. The server leaves them out of its start-up cache warm; `flock.js` deals all five in a fresh order each round with `dealMusic()`, plays each in full one after another and deals again after the last, never opening on the song that just ended |
| `public/activities/ghoul-rush/stages/graveyard/ghoul-sfx-graveyard.js` | The Graveyard's own sounds as data (no imports): `GRAVEYARD_SFX`, its `tones` (the picked `ghoul<Kind><Act>` sounds of the grasping hands, mourners, grave robbers, rotters and their legs, carrion crows and Mother Mourning) and `music` (`ghoulLychgate`, `ghoulGraves`, `ghoulMausoleums`, `ghoulAngel`, named in `ROOM_MUSIC`), merged by `ghoul-sfx.js` after the house's own. Every new stage gets its own `ghoul-sfx-<stage>.js`, listed in `STAGE_SFX` there |
| `public/activities/ghoul-rush/stages/grounds/ghoul-sfx-grounds.js` | The Grounds' own sounds as data (no imports): `GROUNDS_SFX`, its `tones` (the 32 picked `ghoul<Kind><Act>` sounds of the topiary beasts, rootlings, lantern moths, mulch crawlers, the Groundskeeper and the Hedge shears' snip) and `music` (`ghoulMaze`, `ghoulTopiary`, `ghoulGazebo`, `ghoulYard`, named in `ROOM_MUSIC`), merged by `ghoul-sfx.js` after the house's own via `STAGE_SFX` |
| `public/uploads.js` | pictures and documents attached to a note: chips, trays, re-encoding, upload, retry, and the page's shared full-screen picture preview (`openPicview`, the `#picview` dialog every thumbnail opens) |
+24 -8
View File
@@ -528,8 +528,8 @@ working in.
### Activities
The **die** in the top bar, right of the megaphone, opens **Activities**: small
games to play while you wait, say through a long build. Twelve ship today,
**Snake**, **Mini golf**, **Light Trails**, **Bug Hunt**, **Sunset Drive**, **Stack Deploy**, **Bumper Ring**, **Rapids Run**, **Hot Potato**, **Crossing Rush**, **Bounce Road** and **Ghoul Rush**. The window opens on a
games to play while you wait, say through a long build. Thirteen ship today,
**Snake**, **Mini golf**, **Light Trails**, **Bug Hunt**, **Sunset Drive**, **Stack Deploy**, **Bumper Ring**, **Rapids Run**, **Hot Potato**, **Crossing Rush**, **Bounce Road**, **Ghoul Rush** and **Flock Dash**. The window opens on a
**picker**: a card per game with a small cover scene, a line about it, its best
score, and a **Last played** tag on the one you played last, which also has the
focus. Click a card (or walk the cards with the arrows and press space or
@@ -548,15 +548,15 @@ new bests and game over each get a sound of their own. A game can play
chiptune music too, made the same way, which builds as play heats up (Sunset
Drive has a song for each road, Snake a different one at every level, dealt from ten at
the start of a round so none repeats, and Ghoul Rush a track for each room, played at
one steady level and fuller in a boss fight), and Light Trails plays five
recorded songs as background music, each in full, one after another in an
one steady level and fuller in a boss fight), and Light Trails and Flock Dash play five
recorded songs each as background music, each in full, one after another in an
order shuffled for every run: turn on **Play game music** in **User
Preferences → Sounds & activities** (it starts off). **Play game sounds** there turns the games'
sounds (the 3, 2, 1 and the new-best burst included) and their music on or
off and leaves the page's own cues alone; the **Play sounds** switch above it
silences all of it, and a paused or closed game goes quiet at once. A game
with music has its own **Music** slider beside **Full screen**, which sets that
game's music volume and is remembered per game (Snake, Light Trails and Sunset Drive start at 70,
game's music volume and is remembered per game (Snake, Light Trails, Sunset Drive and Flock Dash start at 70,
Ghoul Rush at 65).
- **Snake** speeds up as it grows: 120 ms a step at its starting three cells,
@@ -1431,6 +1431,22 @@ Ghoul Rush at 65).
room starts again after a loss (a hit, a fall or the clock), a random
power-up shimmers a few steps ahead of Planny on every restart until you
clear the room (never a 1UP, and not in the bonus rides).
- **Flock Dash** is a side-scrolling flight through a sunset sky, with Planny
as the lead bird. Hold up or down to climb and dive within a band in the
left part of the sky, and left or right to ease forward or back. Strays
drift in from the right; fly into one and it joins the flock, which
follows the exact path you flew, each bird a set distance behind the one
before. Balloons, gusts, slipstreams, storm clouds and kites are in the
way: a hit on the leader costs one of three lives, and a hit on the line
snaps it there, scattering the birds behind (fly back through them within
3 seconds or they are gone). Eight stages, each faster than the last,
each end at a jet stream portal: with enough birds the flock forms a V
and pays a bonus, and the final portal moves. Tailwind, shield and magnet
crates help, pickups in quick succession build a combo of up to x5, and a
stage with no snap and no bird lost pays a flawless bonus. Five recorded
songs play as background music in a shuffled order. The end screen's nudge
to play again names the next hazard or stage you have yet to reach, and the
furthest stage you reached is kept privately.
- **It never hides your turn.** A new question, a sign-off or a finish pauses
the game at once and shows a banner with **Go to it**, which closes the window
on that question, and **Unpause game**. While that banner is up, only
@@ -1459,10 +1475,10 @@ Ghoul Rush at 65).
P or Esc during the count pauses again.
- **Keys.** Arrows or W/A/S/D steer, space starts and plays (and boosts in
Light Trails, fires while held in Bug Hunt, burns nitro in Sunset Drive,
where held up drives and held down brakes, drops the block in Stack Deploy, dashes in Bumper Ring, where held arrows push, fires while held in Rapids Run, where held up speeds up and held down slows, dashes in Hot Potato, where held arrows run, uses the oldest pickup in Crossing Rush, where an arrow hops once a press, jumps once a press in Bounce Road, where held up drives and held down brakes, and fires while held in Ghoul Rush, where held arrows run, up jumps once a press and down drops through a shelf), P pauses, R starts the round over (from the 3, 2, 1), F (or **Full screen** under the board) gives the game the whole screen and F or Esc puts it back, and Esc closes the window with the game paused. In full screen the board takes the whole screen, as big as its shape allows, with black bars where the shape leaves room, and a panel (the game's name, the score line, the game's **Music** slider for a game with music, Exit full screen) is laid over it: docked in the side bar when that bar is at least 220 px wide, in the bottom bar on a tall screen when that is at least 110 px tall, and otherwise floating in the top right corner (Sunset Drive's 16:9 board on a 16:9 screen), where it shrinks to the score line in the bottom right corner while a round plays and the pointer is still. The board never gives up room for the panel. The pointer hides after two still seconds. In the desktop app the page asks the app (`activities-full`) to lay the console over its bar and terminal and put the window in full screen, since the app's frame allows the page no full screen of its own. A question, a sign-off or a finish takes a full-screen game back to the window's own size as it pauses it. A page with no mouse or trackpad
where held up drives and held down brakes, drops the block in Stack Deploy, dashes in Bumper Ring, where held arrows push, fires while held in Rapids Run, where held up speeds up and held down slows, dashes in Hot Potato, where held arrows run, uses the oldest pickup in Crossing Rush, where an arrow hops once a press, jumps once a press in Bounce Road, where held up drives and held down brakes, fires while held in Ghoul Rush, where held arrows run, up jumps once a press and down drops through a shelf, and climbs and dives in Flock Dash, where held up and down fly the leader and held left and right ease forward and back), P pauses, R starts the round over (from the 3, 2, 1), F (or **Full screen** under the board) gives the game the whole screen and F or Esc puts it back, and Esc closes the window with the game paused. In full screen the board takes the whole screen, as big as its shape allows, with black bars where the shape leaves room, and a panel (the game's name, the score line, the game's **Music** slider for a game with music, Exit full screen) is laid over it: docked in the side bar when that bar is at least 220 px wide, in the bottom bar on a tall screen when that is at least 110 px tall, and otherwise floating in the top right corner (Sunset Drive's 16:9 board on a 16:9 screen), where it shrinks to the score line in the bottom right corner while a round plays and the pointer is still. The board never gives up room for the panel. The pointer hides after two still seconds. In the desktop app the page asks the app (`activities-full`) to lay the console over its bar and terminal and put the window in full screen, since the app's frame allows the page no full screen of its own. A question, a sign-off or a finish takes a full-screen game back to the window's own size as it pauses it. A page with no mouse or trackpad
(touch only) shows "Activities need a keyboard." in place of the board.
- **Best scores** show beside the score while you play and after each round.
Snake, Light Trails, Bug Hunt, Sunset Drive, Stack Deploy, Bumper Ring, Rapids Run, Hot Potato, Crossing Rush, Bounce Road and Ghoul Rush keep their highest score. Mini golf keeps its lowest
Snake, Light Trails, Bug Hunt, Sunset Drive, Stack Deploy, Bumper Ring, Rapids Run, Hot Potato, Crossing Rush, Bounce Road, Ghoul Rush and Flock Dash keep their highest score. Mini golf keeps its lowest
full round on each course, every course on its own, and a half-played round never counts. **Reset best scores** clears them after a
second click to confirm.
The line under the board is a pair of colored chips, Score and Best, with a
@@ -1472,7 +1488,7 @@ Ghoul Rush at 65).
that beats a saved best ends with **New best!** on the end screen, and Mini
golf, which only knows at the end, fires its sparks then. Reduced motion keeps
the colors and drops the movement.
- **Private.** Best scores, Snake's surprises found, Light Trails' furthest arena, Bug Hunt's finds, Sunset Drive's roads found, Stack Deploy's highest floor, Bumper Ring's furthest arena, Rapids Run's furthest dam, Hot Potato's furthest venue, Crossing Rush's furthest zone, Bounce Road's furthest stage, the most Ghoul Rush stages cleared in a run, the last pick and the **Show Activities** switch
- **Private.** Best scores, Snake's surprises found, Light Trails' furthest arena, Bug Hunt's finds, Sunset Drive's roads found, Stack Deploy's highest floor, Bumper Ring's furthest arena, Rapids Run's furthest dam, Hot Potato's furthest venue, Crossing Rush's furthest zone, Bounce Road's furthest stage, the most Ghoul Rush stages cleared in a run, Flock Dash's furthest stage, the last pick and the **Show Activities** switch
(User Preferences → Sounds & activities, which hides the die everywhere) are saved in
`~/.plan2code/console/looks.json`. Nothing about Activities reaches the agent
or the session.
+1 -1
View File
@@ -36,7 +36,7 @@ Details: [Architecture](./.agents-docs/AGENTS-architecture.md) (see Status Line
## Web Console
Optional local browser UI (`src/web-console/`, zero dependencies, detached `node` server on `127.0.0.1`) bundled into every skill via `additionalReferences`. The bare `plan2code` skill opens its dashboard, a card menu that launches any skill in the same session. Pages cover questions, sign-off gates (with an in-page code review), build progress, the living document, an **Ask** chat, a read-only **Workspace** of extra folders (remembered per folder and spec in `~/.plan2code/console/workspaces.json`), a session meter, a **git board** for the `git` workflow (three tabs, Changes, Branches and Sync, opening on the likely next step; branches, pull, push, commits and pull-request links, drawn from `state.git`; contract in `notes/git.md`), **Stop with a handoff** (handoffs live in `~/.plan2code/handoffs/`, owned by `handoffs.mjs`, swept after 30 days, and offered as dashboard chips to pick up in the same session), a private **Notebook** in the top bar (named tabs of Markdown and pictures, a live-preview CodeMirror editor, one notepad per folder in `~/.plan2code/notepads/`, owned by `notepads.mjs`, private: the agent reads a tab only when you start Pathfinder, Plan, Quick Task or Revise plan from the dashboard with it and send the box it fills (an idea box marked `fill: "note"`, up to five ticked pictures attached), which then marks the tab sent via `POST /notepad/tab/sent`; the agent CLI never imports the store; removed only through Cleanup once a month untouched), **Activities** behind the top bar's die (twelve small games, Snake, Mini golf, Light Trails, Bug Hunt, Sunset Drive, Stack Deploy, Bumper Ring, Rapids Run, Hot Potato, Crossing Rush, Bounce Road and Ghoul Rush, listed in `public/activities.js` with one module per game under `public/activities/` (Ghoul Rush is its own folder of modules, `public/activities/ghoul-rush/`) and a card line (`blurb`) each, a picker page of game cards once two are listed that plays one game at a time (another pick drops the last game's round), driven by `screens/activities.js` (keys, key releases for a game with `release()`, canvas pointer events for a game with `pointer()`, one frame timer), paused whenever the person's turn comes and resumed only by the person (while that pause's banner is up, only by its **Unpause game** button), best scores in flat `activityBest<Id>` keys in `looks.json` (lowest wins for a game that sets `lowerIsBetter`; Mini golf opens on a dashboard of its six 18-hole courses, one file each under `public/activities/golf-course-<id>.js`, and keeps a best per course, `activityBestGolf<Course>`), and one number a game may keep between sessions in `activityMemo<Id>` (Snake's tally of surprises found, Light Trails' furthest arena, Bug Hunt's tally of finds, Sunset Drive's roads found, Stack Deploy's highest floor, Bumper Ring's furthest arena, Rapids Run's furthest dam, Hot Potato's furthest venue, Crossing Rush's furthest zone, Bounce Road's furthest stage, Ghoul Rush's most stages cleared in a run), never shown to the agent), a built-in 21-topic Help, the app-only **Implementation Loop** (a dashboard card and a setup screen drawn by the page, `public/screens/loop-setup.js`; the last setup remembered per project in `~/.plan2code/console/loop-setup.json`, owned by `loop-setup.mjs`; a page that locks while `state.loop.driving` is set, until the app posts `loopEnd`; a skill run with `--loop` reports a `loopOutcome` instead of asking for sign-off, per `notes/loop.md`), a first-run Welcome, User Preferences (gear: four tabs, Appearance, Agents & models, System and Sounds & activities, on the `public/tabs.js` helper Help also uses, with `public/prefs.js`, `screens/prefs-dialog.js` and `screens/agents-view.js`), an agent-less **setup** page (the `setup` workflow `plan2code` or the desktop app opens when no agent can run: each built-in's found / outside-PATH / missing state from `agent-lookup.mjs`, install lines, Check again, Use it from here, starter templates and Start, which hands the tab to the new agent through a token-guarded `POST /handover` and a `move` event; the app shows it in its window from a Set up an agent button instead) and a bug/idea link to GitHub issues. On opted-in skills (every workflow but the dashboard, Finalize, Changelog, Git and Handoff) a **Subagents** button in the top bar turns helpers on or off per project and skill (on by default for those skills until switched off, saved in `~/.plan2code/console/subagents.json`), and a Helper strength choice (Balanced, Thrifty, Best, Match my session; rules in `src/shared-references/helper-strength.md`, shipped in the twelve helper skills); the agent hears of it as a standing instruction only when it changes, and reports its helpers in a **Subagents** tab beside Ask (contract in `console-subagents.md`). Per-skill facts live in one list, `public/skills.js`, from which the meter, the resume command, Help's card list and the CLI's workflow list are derived; task files are read through `spec-files.mjs` (sLine truncated
Optional local browser UI (`src/web-console/`, zero dependencies, detached `node` server on `127.0.0.1`) bundled into every skill via `additionalReferences`. The bare `plan2code` skill opens its dashboard, a card menu that launches any skill in the same session. Pages cover questions, sign-off gates (with an in-page code review), build progress, the living document, an **Ask** chat, a read-only **Workspace** of extra folders (remembered per folder and spec in `~/.plan2code/console/workspaces.json`), a session meter, a **git board** for the `git` workflow (three tabs, Changes, Branches and Sync, opening on the likely next step; branches, pull, push, commits and pull-request links, drawn from `state.git`; contract in `notes/git.md`), **Stop with a handoff** (handoffs live in `~/.plan2code/handoffs/`, owned by `handoffs.mjs`, swept after 30 days, and offered as dashboard chips to pick up in the same session), a private **Notebook** in the top bar (named tabs of Markdown and pictures, a live-preview CodeMirror editor, one notepad per folder in `~/.plan2code/notepads/`, owned by `notepads.mjs`, private: the agent reads a tab only when you start Pathfinder, Plan, Quick Task or Revise plan from the dashboard with it and send the box it fills (an idea box marked `fill: "note"`, up to five ticked pictures attached), which then marks the tab sent via `POST /notepad/tab/sent`; the agent CLI never imports the store; removed only through Cleanup once a month untouched), **Activities** behind the top bar's die (thirteen small games, Snake, Mini golf, Light Trails, Bug Hunt, Sunset Drive, Stack Deploy, Bumper Ring, Rapids Run, Hot Potato, Crossing Rush, Bounce Road, Ghoul Rush and Flock Dash, listed in `public/activities.js` with one module per game under `public/activities/` (Ghoul Rush is its own folder of modules, `public/activities/ghoul-rush/`) and a card line (`blurb`) each, a picker page of game cards once two are listed that plays one game at a time (another pick drops the last game's round), driven by `screens/activities.js` (keys, key releases for a game with `release()`, canvas pointer events for a game with `pointer()`, one frame timer), paused whenever the person's turn comes and resumed only by the person (while that pause's banner is up, only by its **Unpause game** button), best scores in flat `activityBest<Id>` keys in `looks.json` (lowest wins for a game that sets `lowerIsBetter`; Mini golf opens on a dashboard of its six 18-hole courses, one file each under `public/activities/golf-course-<id>.js`, and keeps a best per course, `activityBestGolf<Course>`), and one number a game may keep between sessions in `activityMemo<Id>` (Snake's tally of surprises found, Light Trails' furthest arena, Bug Hunt's tally of finds, Sunset Drive's roads found, Stack Deploy's highest floor, Bumper Ring's furthest arena, Rapids Run's furthest dam, Hot Potato's furthest venue, Crossing Rush's furthest zone, Bounce Road's furthest stage, Ghoul Rush's most stages cleared in a run, Flock Dash's furthest stage), never shown to the agent), a built-in 21-topic Help, the app-only **Implementation Loop** (a dashboard card and a setup screen drawn by the page, `public/screens/loop-setup.js`; the last setup remembered per project in `~/.plan2code/console/loop-setup.json`, owned by `loop-setup.mjs`; a page that locks while `state.loop.driving` is set, until the app posts `loopEnd`; a skill run with `--loop` reports a `loopOutcome` instead of asking for sign-off, per `notes/loop.md`), a first-run Welcome, User Preferences (gear: four tabs, Appearance, Agents & models, System and Sounds & activities, on the `public/tabs.js` helper Help also uses, with `public/prefs.js`, `screens/prefs-dialog.js` and `screens/agents-view.js`), an agent-less **setup** page (the `setup` workflow `plan2code` or the desktop app opens when no agent can run: each built-in's found / outside-PATH / missing state from `agent-lookup.mjs`, install lines, Check again, Use it from here, starter templates and Start, which hands the tab to the new agent through a token-guarded `POST /handover` and a `move` event; the app shows it in its window from a Set up an agent button instead) and a bug/idea link to GitHub issues. On opted-in skills (every workflow but the dashboard, Finalize, Changelog, Git and Handoff) a **Subagents** button in the top bar turns helpers on or off per project and skill (on by default for those skills until switched off, saved in `~/.plan2code/console/subagents.json`), and a Helper strength choice (Balanced, Thrifty, Best, Match my session; rules in `src/shared-references/helper-strength.md`, shipped in the twelve helper skills); the agent hears of it as a standing instruction only when it changes, and reports its helpers in a **Subagents** tab beside Ask (contract in `console-subagents.md`). Per-skill facts live in one list, `public/skills.js`, from which the meter, the resume command, Help's card list and the CLI's workflow list are derived; taskLine truncated
One agent list and one lookup rule serve the launcher, the console and the app: `src/launcher/agents.json` (the built-ins and starter templates with per-OS install data) and `src/web-console/agent-lookup.mjs` (`loadAgentList()` and `findAgent()`, both copied by `install.js` into `~/.plan2code/bin/`); the app carries a Rust twin held to the same cases by `scripts/fixtures/agent-lookup-cases.json`.
Building or changing an Activities game: follow the game rules in [Architecture](./.agents-docs/AGENTS-architecture.md) ("Building an Activities game": lives in the solid lives pill, the endless-lives code (`cheat(on)`) in every game with lives, banners placed away from the player and see-through over what matters, pausing left to the window).
File diff suppressed because it is too large. Load diff
+31 -5
View File
@@ -1,4 +1,4 @@
// Web console tests, the activities: the shared game contract every listed game answers, Snake's rules, mini golf's rules, course and controls, Light Trails' rules and rivals, Bug Hunt's waves, bugs and bosses, Sunset Drive's road, traffic and forks, Stack Deploy's drops, perfects and twists, Bumper Ring's physics, rivals and arenas, the lives pill and tones of Rapids Run, Ghoul Rush and Bounce Road (their rules live in their own suites), Hot Potato's bomb, fuse, rivals and venues, and Crossing Rush's lanes, hops, shoves, planner and zones.
// Web console tests, the activities: the shared game contract every listed game answers, Snake's rules, mini golf's rules, course and controls, Light Trails' rules and rivals, Bug Hunt's waves, bugs and bosses, Sunset Drive's road, traffic and forks, Stack Deploy's drops, perfects and twists, Bumper Ring's physics, rivals and arenas, the lives pill and tones of Rapids Run, Ghoul Rush, Bounce Road and Flock Dash (their rules live in their own suites), Hot Potato's bomb, fuse, rivals and venues, and Crossing Rush's lanes, hops, shoves, planner and zones.
// Run with: node --test scripts/test-web-console-activities.mjs
//
// No browser and no server: a game draws only through the canvas it is handed,
@@ -29,6 +29,7 @@ import { hudLayout as hopHudLayout, labelSpot as hopLabelSpot, LANES as HOP_LANE
import * as bounce from "../src/web-console/public/activities/bounce.js";
import * as rapids from "../src/web-console/public/activities/rapids.js";
import * as ghoul from "../src/web-console/public/activities/ghoul-rush/ghoul.js";
import * as flock from "../src/web-console/public/activities/flock.js";
import { ACCENTS } from "../src/web-console/public/palette.js";
import { LIVES, LIVES_BACK, LIVES_INK, livesText, pillContrast } from "../src/web-console/public/activities/pills.js";
@@ -262,8 +263,8 @@ const listedGames = async () => {
/* --------------------------------------------------------------- list */
test("the list names Snake, Mini golf, Light Trails, Bug Hunt, Sunset Drive, Stack Deploy, Bumper Ring, Rapids Run, Hot Potato, Crossing Rush, Bounce Road and Ghoul Rush, and each entry's module is a file under public/activities/", () => {
assert.deepEqual(ACTIVITIES.map((a) => a.id), ["snake", "golf", "trails", "bugs", "drive", "stack", "bumper", "rapids", "fuse", "hop", "bounce", "ghoul"]);
test("the list names Snake, Mini golf, Light Trails, Bug Hunt, Sunset Drive, Stack Deploy, Bumper Ring, Rapids Run, Hot Potato, Crossing Rush, Bounce Road, Ghoul Rush and Flock Dash, and each entry's module is a file under public/activities/", () => {
assert.deepEqual(ACTIVITIES.map((a) => a.id), ["snake", "golf", "trails", "bugs", "drive", "stack", "bumper", "rapids", "fuse", "hop", "bounce", "ghoul", "flock"]);
assert.equal(ACTIVITIES[1].title, "Mini golf");
assert.equal(ACTIVITIES[2].title, "Light Trails");
assert.equal(ACTIVITIES[3].title, "Bug Hunt");
@@ -275,6 +276,7 @@ test("the list names Snake, Mini golf, Light Trails, Bug Hunt, Sunset Drive, Sta
assert.equal(ACTIVITIES[9].title, "Crossing Rush");
assert.equal(ACTIVITIES[10].title, "Bounce Road");
assert.equal(ACTIVITIES[11].title, "Ghoul Rush");
assert.equal(ACTIVITIES[12].title, "Flock Dash");
for (const a of ACTIVITIES) {
assert.ok(Object.isFrozen(a), `${a.id} is frozen`);
assert.equal(a.module, a.id === "ghoul" ? "/activities/ghoul-rush/ghoul.js" : `/activities/${a.id}.js`);
@@ -308,7 +310,7 @@ test("memoKey builds a flat looks.json key from a list id", () => {
test("musicKey builds a flat looks.json key, and a game with music has a default volume a saved one replaces", () => {
assert.equal(musicKey("ghoul"), "activityMusicGhoul");
assert.deepEqual(ACTIVITIES.filter((a) => a.music !== undefined).map((a) => [a.id, a.music]), [["snake", 70], ["trails", 70], ["drive", 70], ["ghoul", 65]], "the games with music, at about the level they were picked at on the prototype pages");
assert.deepEqual(ACTIVITIES.filter((a) => a.music !== undefined).map((a) => [a.id, a.music]), [["snake", 70], ["trails", 70], ["drive", 70], ["ghoul", 65], ["flock", 70]], "the games with music, at about the level they were picked at on the prototype pages");
const ghoulEntry = ACTIVITIES.find((a) => a.id === "ghoul");
assert.equal(musicLevel(ghoulEntry, undefined), 0.65, "nothing saved: the default");
assert.equal(musicLevel(ghoulEntry, "loud"), 0.65, "not a number: the default");
@@ -2450,6 +2452,30 @@ test("Light Trails: a Wide Trail lays your wall three cells wide, and the cells
assert.equal(you.wide.length, 0, "wiped cells leave the list");
});
test("Light Trails: on a Wide Trail you turn onto the side cells just laid, but the older ones are still wall", () => {
const round = racing(trails.newRound(still));
const you = round.riders[0];
park(round, you, 10, 15, "right");
trails.applyPower(round, "wide");
trails.advance(round, trails.STEP_MS, still);
assert.deepEqual({ x: you.x, y: you.y }, { x: 11, y: 15 });
assert.equal(trails.turn(round, "up"), true);
trails.advance(round, trails.STEP_MS, still);
assert.equal(you.alive, true, "the corner turn rides onto the fresh side cell");
assert.deepEqual({ x: you.x, y: you.y }, { x: 11, y: 14 });
assert.ok(!you.wide.some((c) => c.x === 11 && c.y === 14), "that cell is the line now, not a side cell");
// Only the pair beside your head is fresh: one step on, the last pair is wall.
trails.advance(round, trails.STEP_MS, still);
assert.deepEqual({ x: you.x, y: you.y }, { x: 11, y: 13 });
assert.deepEqual(you.fresh.map((c) => `${c.x},${c.y}`).sort(), ["10,13", "12,13"]);
// Riding back down into a side cell laid two steps ago is a crash as ever.
park(round, you, 12, 15, "up");
round.grid[14 * trails.COLS + 12] = 1;
you.fresh = [];
trails.advance(round, trails.STEP_MS + trails.GRACE_MS + 8, still);
assert.equal(you.alive, false, "an older side cell is your wall");
});
test("Light Trails: Hyperjump moves you to an open cell clear of everyone, facing open space", () => {
const round = racing(trails.newRound(still));
const you = round.riders[0];
@@ -6232,7 +6258,7 @@ test("lives read at a glance: a heart per life up to five, a count past that, an
});
test("every game with lives draws them in the lives pill, solid, with a heart per life", () => {
for (const [name, game] of [["trails", trails], ["bugs", bugs], ["bumper", bumper], ["fuse", fuse], ["hop", hop], ["bounce", bounce], ["rapids", rapids], ["ghoul", ghoul]]) {
for (const [name, game] of [["trails", trails], ["bugs", bugs], ["bumper", bumper], ["fuse", fuse], ["hop", hop], ["bounce", bounce], ["rapids", rapids], ["ghoul", ghoul], ["flock", flock]]) {
const { canvas, pills, reset } = pillCanvas("#ffffff");
const g = game.default.create({ canvas });
g.resize(900, 900);
+111 -7
View File
@@ -1,6 +1,6 @@
// Page tests for Activities: the die in the top bar on every screen, the
// window opening on the picker (a card per game, walked by the arrows, one
// game at a time, All games back to it), Light Trails, Bug Hunt, Sunset Drive, Stack Deploy, Bumper Ring, Rapids Run, Hot Potato, Crossing Rush, Bounce Road and Ghoul Rush in play, the keys
// game at a time, All games back to it), Light Trails, Bug Hunt, Sunset Drive, Stack Deploy, Bumper Ring, Rapids Run, Hot Potato, Crossing Rush, Bounce Road, Ghoul Rush and Flock Dash in play, the keys
// staying inside the window, Esc and P, and every pause rule (a new question,
// a finish, a hidden page, a window blur), none of which ever resumes play by
// itself. Mini golf in the real window: aim by mouse, two clicks to putt,
@@ -166,7 +166,7 @@ test("the die sits right of the megaphone and opens on the picker, a card per ga
const next = await s.page.evaluate(() => document.getElementById("btn-feedback").nextElementSibling?.id);
assert.equal(next, "btn-activities");
await openPicker(s);
assert.deepEqual(await cardTitles(s), ["Snake", "Mini golf", "Light Trails", "Bug Hunt", "Sunset Drive", "Stack Deploy", "Bumper Ring", "Rapids Run", "Hot Potato", "Crossing Rush", "Bounce Road", "Ghoul Rush"]);
assert.deepEqual(await cardTitles(s), ["Snake", "Mini golf", "Light Trails", "Bug Hunt", "Sunset Drive", "Stack Deploy", "Bumper Ring", "Rapids Run", "Hot Potato", "Crossing Rush", "Bounce Road", "Ghoul Rush", "Flock Dash"]);
assert.ok(await s.page.locator("#activities-board").isHidden(), "no board behind the picker");
assert.ok(await s.page.locator("#activities-back").isHidden(), "nothing to go back to");
assert.equal(await s.page.locator("#activities-title").innerText(), "Activities", "the header names no game");
@@ -188,9 +188,9 @@ test("the arrows walk the picker's cards, and space or Enter opens the one in fo
assert.equal(await focusedCard(s), "snake");
await s.page.keyboard.press("ArrowRight");
assert.equal(await focusedCard(s), "golf");
for (let i = 0; i < 11; i++) await s.page.keyboard.press("ArrowRight");
assert.equal(await focusedCard(s), "ghoul", "the last card stays put");
for (let i = 0; i < 10; i++) await s.page.keyboard.press("ArrowLeft");
for (let i = 0; i < 12; i++) await s.page.keyboard.press("ArrowRight");
assert.equal(await focusedCard(s), "flock", "the last card stays put");
for (let i = 0; i < 11; i++) await s.page.keyboard.press("ArrowLeft");
assert.equal(await focusedCard(s), "golf");
await s.page.keyboard.press("Enter");
// Mini golf opens on its course dashboard, walked the same way.
@@ -2513,10 +2513,114 @@ test("Ghoul Rush plays in the real window: its board's shape and Planny big enou
}, 5000);
});
test("the server serves the activities' scripts, golf's seventeen, Light Trails, Bug Hunt, Sunset Drive, Stack Deploy, Bumper Ring's two, Rapids Run's two, Hot Potato's two, Crossing Rush's two, Bounce Road's seven, Ghoul Rush's ninety-five, every game's sound effects and the shared pills included", () => {
test("Flock Dash plays in the real window: its board's shape, Enter starts a round, a held up arrow raises the leader until let go, a stray in front of the leader joins the flock, F goes full screen and back, and the last life lost saves the best and the furthest stage", async (t) => {
savedLooks(t, { welcomeSeen: true });
const s = await openSession(await suite.browser(), { t, workflow: "plan", payload: PLAN_WORKING });
await handTicks(s);
// The hazards and crates are cleared before every tick and the leader kept
// in grace, so only the keys and the strays placed here move the round.
await s.page.evaluate(async () => {
const m = await import("/screens/activities.js");
const { ACTIVITIES } = await import("/activities.js");
const flock = (await import("/activities/flock.js")).default;
window.__calm = true;
const watched = {
...flock,
create: (opts) => {
const g = flock.create(opts);
const tick = g.tick;
g.tick = (ms) => {
const r = g.round;
if (window.__calm && r) {
r.hazards.length = r.crates.length = 0;
r.leader.grace = 1e9;
}
tick(ms);
};
return (window.__flock = g);
},
};
m.setActivityList(ACTIVITIES.map((e) => (e.id === "flock" ? { ...e, game: watched } : e)));
});
await openActivities(s, "flock");
assert.equal(await overlay(s), "Press space to start");
const { W, H } = await s.page.evaluate(async () => {
const { W, H } = await import("/activities/flock.js");
return { W, H };
});
const box = await s.page.locator("#activities-canvas").boundingBox();
assert.ok(Math.abs(box.width / box.height - W / H) < 0.02, `a ${W} by ${H} board, not ${box.width} by ${box.height}`);
const you = () =>
s.page.evaluate(() => {
const r = window.__flock.round;
return { ...r.input, y: r.leader.y, flock: r.flock.length, strays: r.strays.length, over: r.over };
});
// Enter starts a round and has no release: nothing may be left held.
await s.page.keyboard.press("Enter");
assert.equal(await overlay(s), "", "Enter starts a round");
await step(s, 20, 16);
let me = await you();
assert.deepEqual([me.up, me.down, me.left, me.right], [false, false, false, false], "the start leaves no key held");
// A held up arrow raises the leader until let go.
const y0 = me.y;
await s.page.keyboard.down("ArrowUp");
await step(s, 12, 16);
me = await you();
assert.ok(me.up && me.y < y0 - 1, `held up climbs (${y0} to ${me.y})`);
await s.page.keyboard.up("ArrowUp");
assert.equal((await you()).up, false, "let go, it stops climbing");
await step(s, 40, 16);
const rest = (await you()).y;
await step(s, 10, 16);
assert.ok(Math.abs((await you()).y - rest) < 0.01, "and the leader holds its height");
// A stray placed just ahead of the leader joins the flock.
const before = (await you()).flock;
await s.page.evaluate(() => {
const r = window.__flock.round;
r.strays.length = 0;
window.__strayId = r.nextId++;
r.strays.push({ id: window.__strayId, x: r.leader.x + 1.5, y: r.leader.y, bob: 0 });
});
await until(async () => (await you()).flock > before || (await step(s, 2, 16), false), 5000);
assert.ok((await you()).flock >= before + 1, "the stray joined the flock");
assert.ok(
await s.page.evaluate(() => !window.__flock.round.strays.some((b) => b.id === window.__strayId)),
"and it is the placed stray that is gone from the sky"
);
// F fills the screen and F puts it back, the round still running.
await s.page.keyboard.press("f");
await until(async () => (await fullParts(s)).full, 5000);
await s.page.keyboard.press("f");
await until(async () => !(await fullParts(s)).full, 5000);
assert.equal(await overlay(s), "", "a running game");
// Lose the last life: the round ends and saves its best and furthest stage.
await s.page.evaluate(async () => {
const { hitLeader } = await import("/activities/flock.js");
window.__calm = false;
const r = window.__flock.round;
r.score = Math.max(r.score, 120);
r.lives = 1;
r.active.shields = 0;
r.leader.grace = 0;
hitLeader(r);
});
await step(s, 10, 16);
await until(async () => (await overlay(s)).startsWith("Score:"), 5000);
const score = await s.page.evaluate(() => window.__flock.score);
assert.ok(score >= 120);
await until(async () => {
const looks = await serverLooks(s);
return looks.activityBestFlock === score && looks.activityMemoFlock === 1;
}, 5000);
});
test("the server serves the activities' scripts, golf's seventeen, Light Trails, Bug Hunt, Sunset Drive, Stack Deploy, Bumper Ring's two, Rapids Run's two, Hot Potato's two, Crossing Rush's two, Bounce Road's seven, Ghoul Rush's ninety-five, Flock Dash's three, every game's sound effects and the shared pills included", () => {
const server = fs.readFileSync(new URL("../src/web-console/static.mjs", import.meta.url), "utf8");
const servable = server.slice(server.indexOf("const SERVABLE = new Set(["), server.indexOf("]);", server.indexOf("const SERVABLE = new Set([")));
for (const file of ["activities.js", "tones.js", "music.js", "activities/snake.js", "activities/snake-music.js", "screens/activities.js", "activities/golf.js", "activities/golf-holes.js", "activities/golf-draw.js", "activities/golf-decor.js", "activities/golf-kit.js", "activities/golf-paint.js", "activities/golf-looks.js", "activities/golf-course-pirate.js", "activities/golf-course-cave.js", "activities/golf-course-dino.js", "activities/golf-course-candy.js", "activities/golf-course-space.js", "activities/golf-course-frost.js", "activities/golf-look-dino.js", "activities/golf-look-candy.js", "activities/golf-look-space.js", "activities/golf-look-frost.js", "activities/trails.js", "activities/bugs.js", "activities/drive.js", "activities/stack.js", "activities/bumper.js", "activities/bumper-draw.js", "activities/rapids.js", "activities/rapids-draw.js", "activities/fuse.js", "activities/fuse-draw.js", "activities/hop.js", "activities/hop-draw.js", "activities/bounce.js", "activities/bounce-draw.js", "activities/bounce-roads.js", "activities/bounce-road.js", "activities/bounce-rivals.js", "activities/bounce-scenery.js", "activities/bounce-cars.js", "activities/ghoul-rush/ghoul.js", "activities/ghoul-rush/draw/ghoul-draw.js", "activities/ghoul-rush/core/ghoul-rooms.js", "activities/ghoul-rush/stages/wing/ghoul-bones.js", "activities/ghoul-rush/stages/wing/ghoul-bones-draw.js", "activities/ghoul-rush/stages/graveyard/ghoul-graveyard.js", "activities/ghoul-rush/stages/graveyard/ghoul-graveyard-draw.js", "activities/ghoul-rush/stages/grounds/ghoul-grounds.js", "activities/ghoul-rush/stages/grounds/ghoul-grounds-draw.js", "activities/ghoul-rush/stages/chapel/ghoul-chapel.js", "activities/ghoul-rush/stages/chapel/ghoul-chapel-draw.js", "activities/ghoul-rush/stages/sanatorium/ghoul-sanatorium.js", "activities/ghoul-rush/stages/sanatorium/ghoul-sanatorium-draw.js", "activities/ghoul-rush/stages/village/ghoul-village.js", "activities/ghoul-rush/stages/village/ghoul-village-draw.js", "activities/ghoul-rush/stages/village/ghoul-village-world.js", "activities/ghoul-rush/stages/village/ghoul-village-wolf.js", "activities/ghoul-rush/stages/mine/ghoul-mine.js", "activities/ghoul-rush/stages/mine/ghoul-mine-draw.js", "activities/ghoul-rush/stages/mine/ghoul-mine-world.js", "activities/ghoul-rush/stages/mine/ghoul-mine-tommy.js", "activities/ghoul-rush/rides/cart/ghoul-cart.js", "activities/ghoul-rush/rides/cart/ghoul-cart-draw.js", "activities/ghoul-rush/rides/sled/ghoul-sled.js", "activities/ghoul-rush/rides/sled/ghoul-sled-draw.js", "activities/ghoul-rush/rides/gurney/ghoul-gurney.js", "activities/ghoul-rush/rides/gurney/ghoul-gurney-draw.js", "activities/ghoul-rush/rides/banister/ghoul-banister.js", "activities/ghoul-rush/rides/banister/ghoul-banister-draw.js", "activities/ghoul-rush/rides/banister/ghoul-sfx-banister.js", "activities/ghoul-rush/rides/hearse/ghoul-hearse.js", "activities/ghoul-rush/rides/hearse/ghoul-hearse-draw.js", "activities/ghoul-rush/rides/wagon/ghoul-wagon.js", "activities/ghoul-rush/rides/wagon/ghoul-wagon-draw.js", "activities/ghoul-rush/rides/pew/ghoul-pew.js", "activities/ghoul-rush/rides/pew/ghoul-pew-draw.js", "activities/ghoul-rush/rides/pew/ghoul-pew-course.js", "activities/ghoul-rush/rides/pew/ghoul-pew-world.js", "activities/ghoul-rush/rides/mower/ghoul-mower.js", "activities/ghoul-rush/rides/mower/ghoul-mower-draw.js", "activities/ghoul-rush/rides/tray/ghoul-tray.js", "activities/ghoul-rush/rides/tray/ghoul-tray-draw.js", "activities/ghoul-rush/stages/carnival/ghoul-carnival.js", "activities/ghoul-rush/stages/carnival/ghoul-carnival-draw.js", "activities/ghoul-rush/stages/carnival/ghoul-carnival-world.js", "activities/ghoul-rush/stages/frozen/ghoul-frozen.js", "activities/ghoul-rush/stages/frozen/ghoul-frozen-draw.js", "activities/ghoul-rush/stages/frozen/ghoul-frozen-world.js", "activities/ghoul-rush/arms/ghoul-flare.js", "activities/ghoul-rush/stages/bog/ghoul-bog.js", "activities/ghoul-rush/stages/bog/ghoul-bog-draw.js", "activities/ghoul-rush/stages/marrow/ghoul-marrow.js", "activities/ghoul-rush/stages/marrow/ghoul-marrow-draw.js", "activities/ghoul-rush/rides/mat/ghoul-mat-room.js", "activities/ghoul-rush/rides/mat/ghoul-mat.js", "activities/ghoul-rush/rides/mat/ghoul-mat-draw.js", "activities/ghoul-rush/stages/marrow/ghoul-dollhouse-room.js", "activities/ghoul-rush/stages/marrow/ghoul-marrow-eye.js", "activities/ghoul-rush/stages/marrow/ghoul-marrow-eye-draw.js", "activities/ghoul-rush/rides/bonestair/ghoul-bonestair-room.js", "activities/ghoul-rush/rides/bonestair/ghoul-bonestair.js", "activities/ghoul-rush/rides/bonestair/ghoul-bonestair-draw.js", "activities/ghoul-rush/stages/marrow/ghoul-pit-room.js", "activities/ghoul-rush/stages/marrow/ghoul-marrow-heart.js", "activities/ghoul-rush/stages/marrow/ghoul-marrow-heart-draw.js", "activities/ghoul-rush/story/ghoul-ending.js", "activities/ghoul-rush/story/ghoul-ending-draw.js", "activities/ghoul-rush/draw/ghoul-picker-draw.js", "aLine truncated
for (const file of ["activities/flock.js", "activities/flock-draw.js", "activities/flock-sfx.js", "activities.js", "tones.js", "music.js", "activities/snake.js", "activities/snake-music.js", "screens/activities.js", "activities/golf.js", "activities/golf-holes.js", "activities/golf-draw.js", "activities/golf-decor.js", "activities/golf-kit.js", "activities/golf-paint.js", "activities/golf-looks.js", "activities/golf-course-pirate.js", "activities/golf-course-cave.js", "activities/golf-course-dino.js", "activities/golf-course-candy.js", "activities/golf-course-space.js", "activities/golf-course-frost.js", "activities/golf-look-dino.js", "activities/golf-look-candy.js", "activities/golf-look-space.js", "activities/golf-look-frost.js", "activities/trails.js", "activities/bugs.js", "activities/drive.js", "activities/stack.js", "activities/bumper.js", "activities/bumper-draw.js", "activities/rapids.js", "activities/rapids-draw.js", "activities/fuse.js", "activities/fuse-draw.js", "activities/hop.js", "activities/hop-draw.js", "activities/bounce.js", "activities/bounce-draw.js", "activities/bounce-roads.js", "activities/bounce-road.js", "activities/bounce-rivals.js", "activities/bounce-scenery.js", "activities/bounce-cars.js", "activities/ghoul-rush/ghoul.js", "activities/ghoul-rush/draw/ghoul-draw.js", "activities/ghoul-rush/core/ghoul-rooms.js", "activities/ghoul-rush/stages/wing/ghoul-bones.js", "activities/ghoul-rush/stages/wing/ghoul-bones-draw.js", "activities/ghoul-rush/stages/graveyard/ghoul-graveyard.js", "activities/ghoul-rush/stages/graveyard/ghoul-graveyard-draw.js", "activities/ghoul-rush/stages/grounds/ghoul-grounds.js", "activities/ghoul-rush/stages/grounds/ghoul-grounds-draw.js", "activities/ghoul-rush/stages/chapel/ghoul-chapel.js", "activities/ghoul-rush/stages/chapel/ghoul-chapel-draw.js", "activities/ghoul-rush/stages/sanatorium/ghoul-sanatorium.js", "activities/ghoul-rush/stages/sanatorium/ghoul-sanatorium-draw.js", "activities/ghoul-rush/stages/village/ghoul-village.js", "activities/ghoul-rush/stages/village/ghoul-village-draw.js", "activities/ghoul-rush/stages/village/ghoul-village-world.js", "activities/ghoul-rush/stages/village/ghoul-village-wolf.js", "activities/ghoul-rush/stages/mine/ghoul-mine.js", "activities/ghoul-rush/stages/mine/ghoul-mine-draw.js", "activities/ghoul-rush/stages/mine/ghoul-mine-world.js", "activities/ghoul-rush/stages/mine/ghoul-mine-tommy.js", "activities/ghoul-rush/rides/cart/ghoul-cart.js", "activities/ghoul-rush/rides/cart/ghoul-cart-draw.js", "activities/ghoul-rush/rides/sled/ghoul-sled.js", "activities/ghoul-rush/rides/sled/ghoul-sled-draw.js", "activities/ghoul-rush/rides/gurney/ghoul-gurney.js", "activities/ghoul-rush/rides/gurney/ghoul-gurney-draw.js", "activities/ghoul-rush/rides/banister/ghoul-banister.js", "activities/ghoul-rush/rides/banister/ghoul-banister-draw.js", "activities/ghoul-rush/rides/banister/ghoul-sfx-banister.js", "activities/ghoul-rush/rides/hearse/ghoul-hearse.js", "activities/ghoul-rush/rides/hearse/ghoul-hearse-draw.js", "activities/ghoul-rush/rides/wagon/ghoul-wagon.js", "activities/ghoul-rush/rides/wagon/ghoul-wagon-draw.js", "activities/ghoul-rush/rides/pew/ghoul-pew.js", "activities/ghoul-rush/rides/pew/ghoul-pew-draw.js", "activities/ghoul-rush/rides/pew/ghoul-pew-course.js", "activities/ghoul-rush/rides/pew/ghoul-pew-world.js", "activities/ghoul-rush/rides/mower/ghoul-mower.js", "activities/ghoul-rush/rides/mower/ghoul-mower-draw.js", "activities/ghoul-rush/rides/tray/ghoul-tray.js", "activities/ghoul-rush/rides/tray/ghoul-tray-draw.js", "activities/ghoul-rush/stages/carnival/ghoul-carnival.js", "activities/ghoul-rush/stages/carnival/ghoul-carnival-draw.js", "activities/ghoul-rush/stages/carnival/ghoul-carnival-world.js", "activities/ghoul-rush/stages/frozen/ghoul-frozen.js", "activities/ghoul-rush/stages/frozen/ghoul-frozen-draw.js", "activities/ghoul-rush/stages/frozen/ghoul-frozen-world.js", "activities/ghoul-rush/arms/ghoul-flare.js", "activities/ghoul-rush/stages/bog/ghoul-bog.js", "activities/ghoul-rush/stages/bog/ghoul-bog-draw.js", "activities/ghoul-rush/stages/marrow/ghoul-marrow.js", "activities/ghoul-rush/stages/marrow/ghoul-marrow-draw.js", "activities/ghoul-rush/rides/mat/ghoul-mat-room.js", "activities/ghoul-rush/rides/mat/ghoul-mat.js", "activities/ghoul-rush/rides/mat/ghoul-mat-draw.js", "activities/ghoul-rush/stages/marrow/ghoul-dollhouse-room.js", "activities/ghoul-rush/stages/marrow/ghoul-marrow-eye.js", "activities/ghoul-rush/stages/marrow/ghoul-marrow-eye-draw.js", "activities/ghoul-rush/rides/bonestair/ghoul-bonestair-room.js", "activities/ghoul-rush/rides/bonestair/ghoul-bonestair.js", "activities/ghoul-rush/rides/bonestair/ghoul-bonestair-draw.js", "activities/ghoul-rush/stages/marrow/ghoul-pit-room.js", "activities/ghoul-rush/stages/marrow/ghoul-marrow-heart.js", "activities/ghoul-rush/stages/marrow/ghoul-marrow-heart-draw.js", "activities/ghoul-rush/story/ghoul-ending.js", "activities/ghoul-rush/storLine truncated
assert.ok(servable.includes(`"${file}"`), `SERVABLE includes ${file}`);
}
for (let n = 1; n <= 5; n++) {
assert.ok(servable.includes(`"activities/flock-dash/${n}.mp3"`), `SERVABLE includes activities/flock-dash/${n}.mp3`);
}
});
+16
View File
@@ -18,6 +18,8 @@ import { MUSIC_TRACKS } from "../src/web-console/public/activities/snake.js";
import snakeSfx from "../src/web-console/public/activities/snake-sfx.js";
import { MUSIC_TRACKS as TRAILS_TRACKS } from "../src/web-console/public/activities/trails.js";
import trailsSfx from "../src/web-console/public/activities/trails-sfx.js";
import { MUSIC_TRACKS as FLOCK_TRACKS } from "../src/web-console/public/activities/flock.js";
import flockSfx from "../src/web-console/public/activities/flock-sfx.js";
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const GAMES = path.join(ROOT, "src/web-console/public/activities");
@@ -402,6 +404,20 @@ test("music: Light Trails lists exactly the songs it has, each an mp3 on disk th
}
});
test("music: Flock Dash lists exactly the songs it has, each an mp3 on disk the server serves, and no chiptune tracks", () => {
const songs = new Set(songNames());
assert.equal(flockSfx.music, undefined, "its music is the songs, not note data");
assert.deepEqual([...FLOCK_TRACKS].sort(), Object.keys(flockSfx.songs).sort(), "the game lists the songs its sound file has");
for (const name of FLOCK_TRACKS) {
assert.ok(songs.has(name), `song "${name}" exists`);
assert.equal(SONG_TABLES.filter((t) => Object.hasOwn(t, name)).length, 1, `${name} is defined once`);
assert.ok(!musicNames().includes(name), `${name} is not also a chiptune track`);
const file = flockSfx.songs[name];
assert.ok(SERVABLE.has(file), `${file} is servable`);
assert.ok(fs.statSync(path.join(ROOT, "src/web-console/public", file)).size > 0, `${file} is on disk`);
}
});
// A stand-in <audio>: records what music.js asks of it.
class FakeAudio {
static made = [];
+1
View File
@@ -44,6 +44,7 @@ export const ACTIVITIES = Object.freeze([
entry("hop", "Crossing Rush", "Hop through traffic and rivers. Race your rivals to the top."),
entry("bounce", "Bounce Road", "Ten wild stages of toy-car mayhem. Jump, stomp and outrun the Monster truck."),
entry("ghoul", "Ghoul Rush", "Run and gun through a pitch-dark haunted house. Keep moving.", { music: 65, module: "/activities/ghoul-rush/ghoul.js" }),
entry("flock", "Flock Dash", "Lead your flock through the sunset sky. Dodge everything, keep the line.", { music: 70 }),
]);
const cap = (word) => word[0].toUpperCase() + word.slice(1);
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,765 @@
// Plan2Code Web Console - Flock Dash's drawing: the sunset sky, the hazards and the portal, the strays and the flock, Planny as the lead bird with a star for an eye, the pills and the banners, from a view flock.js refills.
//
// Drawing only: no rules and no state of its own. flock.js hands drawScene()
// one view object of the moment (the round, the board's geometry, the colors
// readColors() took from the page), so the rules never touch a canvas and this
// file never decides anything. Everything is drawn in field units under one
// scale. Anything that moves on its own (wings, a stray's bob) follows the
// view's clock, never Math.random(), so a paused game's frame stays still.
//
// The sky (one palette per stage), the hazards and the birds keep their own fixed
// colors, the same in light and dark. The pills are opaque dark with text that reads on them at 4.5:1
// (pills.js). The strip the pills sit on and Planny (in your highlight) follow
// the page.
import { drawPill, LIVES, livesText } from "./pills.js";
const FALLBACK_COLORS = Object.freeze({ board: "#ffffff", line: "#e4ddd1", you: "#206cc3", ink: "#1d1a17" });
// The page's tokens, read again at each round and each resize, so the board
// follows a theme or highlight change made while the game sat paused. A stub
// canvas in Node has no computed style, so every color falls back.
export function readColors(canvas) {
let style = null;
try {
style = typeof getComputedStyle === "function" ? getComputedStyle(canvas) : null;
} catch {}
const pick = (name, fallback) => (style && style.getPropertyValue(name).trim()) || fallback;
return {
board: pick("--panel", FALLBACK_COLORS.board),
line: pick("--rule", FALLBACK_COLORS.line),
you: pick("--accent", FALLBACK_COLORS.you),
ink: pick("--ink", FALLBACK_COLORS.ink),
};
}
export const GOLD = "#f5b301";
export const STAGE_COLOR = "#ff9a4d";
export const DANGER = "#ff5a5a";
export const FLOCK_COLOR = "#2b2140";
export const STRAY_COLOR = "#fff3dc";
export const HAZARD_COLORS = Object.freeze({ balloon: "#e8413c", gust: "#d9f2ff", stream: "#7fe3f0", cluster: "#b44fd6", storm: "#3a3550", kite: "#2fbf71" });
export const POWER_COLORS = Object.freeze({ tailwind: "#5fd7a8", shield: "#4fc3f7", magnet: "#c58bff" });
export const SUCCESS = "#5fd77a";
const STRAY_RIM = "#2b2140";
// One palette per stage, golden afternoon deepening through sunset to violet
// dusk: the sky's three colors, the clouds' tint, the sun's color and how far
// down the field it sits (past 1 it has set), and the pale rim followers need
// once the sky is as dark as they are. The first stars come out at stage 8.
export const SKIES = Object.freeze({
1: Object.freeze({ top: "#5b8fc7", mid: "#e9a95c", horizon: "#ffcb6b", cloud: "#fff4dc", sun: "#fff3b0", sunY: 0.55, rim: null, stars: 0 }),
2: Object.freeze({ top: "#4f76b8", mid: "#ea9a58", horizon: "#ffc062", cloud: "#ffe9cc", sun: "#ffeaa0", sunY: 0.62, rim: null, stars: 0 }),
3: Object.freeze({ top: "#4a5fa6", mid: "#e8834f", horizon: "#ffb05a", cloud: "#ffdcc0", sun: "#ffe08a", sunY: 0.68, rim: null, stars: 0 }),
4: Object.freeze({ top: "#4a4d96", mid: "#e26c5a", horizon: "#ff9a52", cloud: "#ffcdb8", sun: "#ffd070", sunY: 0.74, rim: null, stars: 0 }),
5: Object.freeze({ top: "#453f88", mid: "#cf5a72", horizon: "#f98a55", cloud: "#f4b8b8", sun: "#ffb860", sunY: 0.8, rim: null, stars: 0 }),
6: Object.freeze({ top: "#3d3378", mid: "#b44d86", horizon: "#ef7a5c", cloud: "#dfa0c0", sun: "#ff9f58", sunY: 0.86, rim: "#ffd9a8", stars: 0 }),
7: Object.freeze({ top: "#2f2866", mid: "#8a4392", horizon: "#d9656c", cloud: "#b784c4", sun: "#ff8a5c", sunY: 0.93, rim: "#ffd9a8", stars: 0 }),
8: Object.freeze({ top: "#1c1a4a", mid: "#4f2f80", horizon: "#a8487c", cloud: "#7c63a8", sun: "#ff7a6a", sunY: 1.02, rim: "#ffd9a8", stars: 26 }),
});
const skyFor = (stage) => SKIES[stage] || SKIES[1];
const SUN_X = 0.72;
const SUN_R = 6.5;
const RIM = 0.32;
// The two cloud layers: how fast each scrolls against the sky, how many clouds,
// their size and strength, and the band of height they keep to.
const CLOUD_LAYERS = Object.freeze([
Object.freeze({ rate: 0.3, count: 5, size: 0.8, alpha: 0.35, top: 0.04, band: 0.4 }),
Object.freeze({ rate: 0.6, count: 4, size: 1.3, alpha: 0.5, top: 0.22, band: 0.55 }),
]);
// Past each edge a cloud wraps out of sight: half this is more than the widest reaches.
const CLOUD_RUN = 40;
const BLINK_MS = 110;
const LEADER_TILT = 0.5;
const LEADER_W = 5;
const LEADER_H = 4;
const LEADER_INK = "#1d1a17";
const BALLOON_CREAM = "#fff3dc";
const BASKET = "#7a4d2b";
const PARTY = Object.freeze([HAZARD_COLORS.cluster, "#ff5fa2", "#38b6ff", "#ffd23f", "#2fbf71"]);
const GLOW_STEPS = 3;
const GLOW = 2.2;
const GLOW_FINAL = 4;
const RING_RX = 3.4;
const RING_RX_FINAL = 2.6;
const V_FADE_MS = 400;
const JAG_STEPS = 7;
const BOB = 0.6;
const BOB_RATE = 0.003;
const FLAP_RATE = 0.014;
const TAU = Math.PI * 2;
const STREAK_GAP = 11;
const STREAK_LEN = 5;
const LOOSE_ALPHA_MIN = 0.25;
const BANNER_SHADE = "rgba(0, 0, 0, 0.3)";
const END_SHADE = "rgba(0, 0, 0, 0.55)";
const END_H = 18;
const CRATE_BOX = 2.6;
const CRATE_GLOW = 3.4;
const WIND_STREAKS = 5;
const WIND_RUN = 18;
const WIND_LEN = 4;
const WIND_RATE = 40;
const pillWidth = (h, text) => h * 0.7 + text.length * h * 0.42;
function pill(ctx, x, y, h, text, color, fill = 1) {
ctx.font = `800 ${h * 0.62}px system-ui, -apple-system, "Segoe UI", sans-serif`;
drawPill(ctx, x, y, pillWidth(h, text), h, text, color, fill, y + h * 0.54);
}
const HUD_SHRINK = 0.92;
const HUD_SHRINK_MIN = 0.6;
function layPills(h, W, lives, hud, stripH) {
const gap = h * 0.3;
const edge = h * 0.4;
const y0 = h * 0.35;
const out = [];
let x = edge;
let y = y0;
const put = (text, color, fill = 1) => {
const w = pillWidth(h, text);
if (x > edge && x + w > W - edge) {
x = edge;
y += h + gap;
}
out.push({ x, y, w, text, color, fill });
x += w + gap;
};
put(hud.stage, STAGE_COLOR);
put(livesText(lives), LIVES);
put(`Score ${hud.score}`, GOLD);
put(`Flock ${hud.flock} / ${hud.min}`, hud.flock >= hud.min ? SUCCESS : STRAY_COLOR);
if (hud.combo > 1) put(`x${hud.combo}`, GOLD);
for (const p of hud.powers || []) put(p.text, p.color, p.fill);
const drop = Math.max(0, (stripH - (y + h) - y0) / 2);
for (const p of out) {
p.y += drop;
p.h = h;
}
return { out, over: stripH ? y + h > stripH : false };
}
// Where the pills go, `h` units tall in a strip `stripH` tall on a board `W`
// wide: the stage, lives, the score and the flock against the portal's minimum
// (in the success color once met) from the left, then the combo
// while it is above 1 and the power-ups running. A row that
// would leave the strip shrinks every pill a step at a time until it fits; only
// past HUD_SHRINK_MIN does a row spill below the strip, over the field, where
// drawScene paints the pills last.
export function hudLayout(h, W, lives, hud, stripH = 0) {
let k = 1;
let laid = layPills(h, W, lives, hud, stripH);
while (laid.over && k > HUD_SHRINK_MIN) {
k = Math.max(HUD_SHRINK_MIN, k * HUD_SHRINK);
laid = layPills(h * k, W, lives, hud, stripH);
}
return laid.out;
}
function drawHud(ctx, v) {
const { g, colors } = v;
ctx.fillStyle = colors.board;
ctx.fillRect(0, 0, g.W, g.HUD_H);
ctx.fillStyle = colors.line;
ctx.fillRect(0, g.HUD_H - 0.25, g.W, 0.25);
}
function drawPills(ctx, v) {
const { g } = v;
if (v.state !== "running" && v.state !== "paused") return;
for (const p of hudLayout(v.pillH, g.W, v.round.infinite ? Infinity : v.round.lives, v.hud, g.HUD_H)) pill(ctx, p.x, p.y, p.h, p.text, p.color, p.fill);
}
// A number from 0 to 1 for a seed and an index, so the clouds and stars of a
// round always sit in the same places.
function scatter(seed, k) {
let t = Math.imul((seed >>> 0) ^ Math.imul(k + 1, 0x9e3779b1), 0x5bd1e995);
t ^= t >>> 15;
t = Math.imul(t, t | 61);
t ^= t >>> 13;
return (t >>> 0) / 4294967296;
}
function disc(ctx, x, y, r, color) {
ctx.fillStyle = color;
ctx.beginPath();
ctx.arc(x, y, r, 0, TAU);
ctx.fill();
}
function drawStars(ctx, v, sky) {
const { g, round } = v;
ctx.fillStyle = "#ffffff";
for (let k = 0; k < sky.stars; k++) {
ctx.globalAlpha = 0.45 + 0.45 * Math.abs(Math.sin(v.clock * 0.0012 + k));
ctx.fillRect(scatter(round.seed, 1000 + k) * g.FIELD_W, scatter(round.seed, 2000 + k) * g.FIELD_H * 0.6, 0.3, 0.3);
}
ctx.globalAlpha = 1;
}
function drawSun(ctx, g, sky) {
const x = g.FIELD_W * SUN_X;
const y = g.FIELD_H * sky.sunY;
ctx.globalAlpha = 0.16;
disc(ctx, x, y, SUN_R * 1.9, sky.sun);
ctx.globalAlpha = 0.28;
disc(ctx, x, y, SUN_R * 1.4, sky.sun);
ctx.globalAlpha = 1;
disc(ctx, x, y, SUN_R, sky.sun);
}
// Two layers of clouds drifting behind everything, slower than the sky, wrapping
// around from their places in the round's seed.
function drawClouds(ctx, v, sky) {
const { g, round } = v;
const run = g.FIELD_W + CLOUD_RUN;
ctx.fillStyle = sky.cloud;
CLOUD_LAYERS.forEach((layer, l) => {
ctx.globalAlpha = layer.alpha;
for (let k = 0; k < layer.count; k++) {
const key = (l + 1) * 100 + k * 3;
const home = scatter(round.seed, key) * run - round.scroll * layer.rate;
const x = ((home % run) + run) % run - CLOUD_RUN / 2;
const y = (layer.top + scatter(round.seed, key + 1) * layer.band) * g.FIELD_H;
const w = (6 + scatter(round.seed, key + 2) * 8) * layer.size;
ctx.beginPath();
ctx.ellipse(x, y, w, w * 0.28, 0, 0, TAU);
ctx.ellipse(x - w * 0.35, y - w * 0.14, w * 0.42, w * 0.26, 0, 0, TAU);
ctx.ellipse(x + w * 0.25, y - w * 0.2, w * 0.5, w * 0.32, 0, 0, TAU);
ctx.fill();
}
});
ctx.globalAlpha = 1;
}
function drawSky(ctx, v) {
const { g, round } = v;
const palette = skyFor(round.stage);
const sky = typeof ctx.createLinearGradient === "function" ? ctx.createLinearGradient(0, 0, 0, g.FIELD_H) : null;
if (sky) {
sky.addColorStop(0, palette.top);
sky.addColorStop(0.58, palette.mid);
sky.addColorStop(1, palette.horizon);
}
ctx.fillStyle = sky || palette.mid;
ctx.fillRect(0, 0, g.FIELD_W, g.FIELD_H);
drawStars(ctx, v, palette);
drawSun(ctx, g, palette);
drawClouds(ctx, v, palette);
}
// How a wing sits at this moment of its beat, from -1 (down) to 1 (up).
const flapAt = (clock, phase) => Math.sin(clock * FLAP_RATE + phase);
function birdBody(ctx, x, y, r) {
ctx.moveTo(x + r, y);
ctx.ellipse(x, y, r, r * 0.5, 0, 0, TAU);
ctx.moveTo(x + r * 0.85, y - r * 0.2);
ctx.lineTo(x + r * 1.5, y);
ctx.lineTo(x + r * 0.85, y + r * 0.2);
ctx.closePath();
}
// A wing from the shoulder at x, its tip `lift` above the body and swept back.
function birdWing(ctx, x, y, r, lift) {
ctx.moveTo(x + r * 0.4, y);
ctx.quadraticCurveTo(x, y - lift * 0.7, x - r * 0.75, y - lift);
ctx.quadraticCurveTo(x - r * 0.3, y - lift * 0.25, x - r * 0.45, y);
ctx.closePath();
}
// A small bird flying right, `r` units long: a body and two wings on their beat,
// each filled on its own, with a rim under them when the sky needs one.
function drawBird(ctx, x, y, r, color, beat, rim) {
const near = r * 1.5 * beat;
const far = r * 1.05 * beat;
const back = x - r * 0.4;
if (rim) {
ctx.strokeStyle = rim;
ctx.lineWidth = RIM;
ctx.beginPath();
birdBody(ctx, x, y, r);
birdWing(ctx, x, y, r, near);
birdWing(ctx, back, y, r, far);
ctx.stroke();
}
ctx.fillStyle = color;
ctx.beginPath();
birdBody(ctx, x, y, r);
ctx.fill();
ctx.beginPath();
birdWing(ctx, back, y, r, far);
ctx.fill();
ctx.beginPath();
birdWing(ctx, x, y, r, near);
ctx.fill();
}
function drawStar(ctx, x, y, r, color) {
ctx.fillStyle = color;
ctx.strokeStyle = LEADER_INK;
ctx.lineWidth = 0.14;
ctx.beginPath();
for (let k = 0; k < 10; k++) {
const a = -Math.PI / 2 + (k * Math.PI) / 5;
const d = k % 2 ? r * 0.42 : r;
if (k) ctx.lineTo(x + Math.cos(a) * d, y + Math.sin(a) * d);
else ctx.moveTo(x + Math.cos(a) * d, y + Math.sin(a) * d);
}
ctx.closePath();
ctx.stroke();
ctx.fill();
}
function roundedBox(ctx, x, y, w, h, r) {
ctx.beginPath();
ctx.moveTo(x + r, y);
ctx.lineTo(x + w - r, y);
ctx.quadraticCurveTo(x + w, y, x + w, y + r);
ctx.lineTo(x + w, y + h - r);
ctx.quadraticCurveTo(x + w, y + h, x + w - r, y + h);
ctx.lineTo(x + r, y + h);
ctx.quadraticCurveTo(x, y + h, x, y + h - r);
ctx.lineTo(x, y + r);
ctx.quadraticCurveTo(x, y, x + r, y);
ctx.closePath();
}
// Planny leads, in bird form: his box in your highlight, the star for an eye, two
// wings on the beat and his feet tucked up, tilted with his climb. He blinks
// while nothing can hit him.
function drawLeader(ctx, v) {
const { leader } = v.round;
const you = v.colors.you;
const beat = flapAt(v.clock, 0);
if (leader.grace > 0 && Math.floor(v.clock / BLINK_MS) % 2) ctx.globalAlpha = 0.35;
ctx.save();
ctx.translate(leader.sx, leader.y);
ctx.rotate(Math.max(-1, Math.min(1, leader.vy / v.g.CLIMB)) * LEADER_TILT);
const wing = (x, lift) => {
ctx.beginPath();
birdWing(ctx, x, 0, 2.2, lift);
ctx.fillStyle = you;
ctx.fill();
ctx.strokeStyle = LEADER_INK;
ctx.lineWidth = 0.22;
ctx.stroke();
};
wing(-1.2, 2.7 * beat);
ctx.strokeStyle = LEADER_INK;
ctx.lineWidth = 0.32;
ctx.beginPath();
ctx.moveTo(-0.9, LEADER_H / 2);
ctx.lineTo(-1.9, LEADER_H / 2 + 0.55);
ctx.moveTo(0.5, LEADER_H / 2);
ctx.lineTo(-0.5, LEADER_H / 2 + 0.55);
ctx.stroke();
ctx.fillStyle = GOLD;
ctx.beginPath();
ctx.moveTo(LEADER_W / 2 - 0.1, -0.6);
ctx.lineTo(LEADER_W / 2 + 1.1, 0.1);
ctx.lineTo(LEADER_W / 2 - 0.1, 0.8);
ctx.closePath();
ctx.fill();
roundedBox(ctx, -LEADER_W / 2, -LEADER_H / 2, LEADER_W, LEADER_H, 1.1);
ctx.fillStyle = you;
ctx.fill();
ctx.strokeStyle = LEADER_INK;
ctx.lineWidth = 0.25;
ctx.stroke();
drawStar(ctx, 0.75, -0.45, 1.1, GOLD);
wing(-0.5, 3.1 * beat);
ctx.restore();
ctx.globalAlpha = 1;
}
// A hot-air balloon: the striped envelope (its hit circle), ropes and a basket.
function drawHotAir(ctx, x, y, r) {
disc(ctx, x, y, r, HAZARD_COLORS.balloon);
ctx.fillStyle = BALLOON_CREAM;
ctx.beginPath();
ctx.ellipse(x, y, r * 0.62, r * 0.98, 0, 0, TAU);
ctx.fill();
ctx.fillStyle = HAZARD_COLORS.balloon;
ctx.beginPath();
ctx.ellipse(x, y, r * 0.26, r * 0.98, 0, 0, TAU);
ctx.fill();
ctx.strokeStyle = BASKET;
ctx.lineWidth = 0.18;
ctx.beginPath();
ctx.moveTo(x - r * 0.5, y + r * 0.85);
ctx.lineTo(x - 0.6, y + r + 0.9);
ctx.moveTo(x + r * 0.5, y + r * 0.85);
ctx.lineTo(x + 0.6, y + r + 0.9);
ctx.stroke();
ctx.fillStyle = BASKET;
ctx.fillRect(x - 0.7, y + r + 0.9, 1.4, 1);
}
// A bunch of party balloons, their strings meeting at a knot under them.
function drawBunch(ctx, x, y, h) {
const knotY = y + h.h / 2 + 1;
ctx.strokeStyle = STRAY_RIM;
ctx.lineWidth = 0.14;
ctx.beginPath();
for (const p of h.parts) {
ctx.moveTo(x + p.dx, y + p.dy + p.r);
ctx.lineTo(x, knotY);
}
ctx.stroke();
h.parts.forEach((p, i) => {
disc(ctx, x + p.dx, y + p.dy, p.r, PARTY[i % PARTY.length]);
ctx.globalAlpha = 0.45;
disc(ctx, x + p.dx - p.r * 0.35, y + p.dy - p.r * 0.35, p.r * 0.25, "#ffffff");
ctx.globalAlpha = 1;
});
}
function drawBand(ctx, x, y, w, h, color, alpha) {
ctx.globalAlpha = alpha;
ctx.fillStyle = color;
ctx.fillRect(x, y - h / 2, w, h);
ctx.globalAlpha = 1;
}
// A gust's warning: arrows at its height along the right edge, pulsing.
function drawGustWarning(ctx, v, h) {
const { g } = v;
ctx.globalAlpha = 0.55 + 0.45 * Math.sin(v.clock * 0.014);
ctx.strokeStyle = HAZARD_COLORS.gust;
ctx.lineWidth = 0.5;
for (let k = 0; k < 3; k++) {
const x = g.FIELD_W - 2 - k * 2.4;
ctx.beginPath();
ctx.moveTo(x, h.y - h.h / 2);
ctx.lineTo(x - 1.6, h.y);
ctx.lineTo(x, h.y + h.h / 2);
ctx.stroke();
}
ctx.globalAlpha = 1;
}
// A live gust: a white band, streaked along its way.
function drawGust(ctx, v, h, sx) {
drawBand(ctx, sx, h.y, h.w, h.h, HAZARD_COLORS.gust, 0.28);
ctx.globalAlpha = 0.75;
ctx.strokeStyle = "#ffffff";
ctx.lineWidth = 0.28;
for (let k = 0; k < 7; k++) {
const at = (k * 5.3 + v.clock * 0.03) % h.w;
const y = h.y + ((k % 3) - 1) * (h.h / 3.2);
ctx.beginPath();
ctx.moveTo(sx + h.w - at, y);
ctx.lineTo(sx + h.w - at + 4, y);
ctx.stroke();
}
ctx.globalAlpha = 1;
}
// Streaks flowing toward the player at twice the stage's speed.
function drawStream(ctx, v, h, sx) {
drawBand(ctx, sx, h.y, h.w, h.h, HAZARD_COLORS.stream, 0.22);
ctx.strokeStyle = HAZARD_COLORS.stream;
ctx.lineWidth = 0.25;
for (const y of [h.y - h.h / 2, h.y + h.h / 2]) {
ctx.beginPath();
ctx.moveTo(sx, y);
ctx.lineTo(sx + h.w, y);
ctx.stroke();
}
const flow = (v.clock / 1000) * v.round.speed * 2;
for (let row = 0; row < 3; row++) {
const y = h.y + (row - 1) * (h.h / 3);
for (let at = (row * 7 - flow) % STREAK_GAP; at < h.w; at += STREAK_GAP) {
if (at < 0) continue;
ctx.beginPath();
ctx.moveTo(sx + at, y);
ctx.lineTo(sx + Math.min(h.w, at + STREAK_LEN), y);
ctx.stroke();
}
}
}
// A kite on its string, the line that snaps a bird: a diamond with its spars and
// a tail of bows that swings with the kite, hanging away from its string.
function drawKite(ctx, v, h, sx, tipX) {
const { g } = v;
const R = g.KITE_R;
ctx.strokeStyle = STRAY_RIM;
ctx.lineWidth = 0.3;
ctx.beginPath();
ctx.moveTo(sx, h.top ? 0 : g.FIELD_H);
ctx.lineTo(tipX, h.y);
ctx.stroke();
ctx.fillStyle = HAZARD_COLORS.kite;
ctx.beginPath();
ctx.moveTo(tipX, h.y - R);
ctx.lineTo(tipX + R, h.y);
ctx.lineTo(tipX, h.y + R);
ctx.lineTo(tipX - R, h.y);
ctx.closePath();
ctx.fill();
ctx.strokeStyle = BALLOON_CREAM;
ctx.lineWidth = 0.18;
ctx.beginPath();
ctx.moveTo(tipX, h.y - R);
ctx.lineTo(tipX, h.y + R);
ctx.moveTo(tipX - R, h.y);
ctx.lineTo(tipX + R, h.y);
ctx.stroke();
const swing = Math.sin(v.clock * 0.004 + h.phase) * 0.7;
const away = h.top ? 1 : -1;
ctx.fillStyle = "#ffd23f";
for (let k = 1; k <= 3; k++) {
const x = tipX + swing * k * 0.6 - k * 0.5;
const y = h.y + away * (R + k * 1.1);
ctx.beginPath();
ctx.moveTo(x - 0.5, y - 0.3);
ctx.lineTo(x + 0.5, y + 0.3);
ctx.lineTo(x + 0.5, y - 0.3);
ctx.lineTo(x - 0.5, y + 0.3);
ctx.closePath();
ctx.fill();
}
}
// A dark cloud; while it beats, a warning column that pulses, then the strike
// down it as a jagged bolt inside the column it can hit.
function drawStorm(ctx, v, h, sx) {
const { g, round } = v;
disc(ctx, sx - h.w * 0.25, h.y, h.h * 0.8, HAZARD_COLORS.storm);
disc(ctx, sx + h.w * 0.25, h.y, h.h * 0.8, HAZARD_COLORS.storm);
disc(ctx, sx, h.y - h.h * 0.2, h.h, HAZARD_COLORS.storm);
ctx.globalAlpha = 0.5;
ctx.fillStyle = "#5a5474";
ctx.beginPath();
ctx.ellipse(sx, h.y - h.h * 0.45, h.w * 0.32, h.h * 0.4, 0, 0, TAU);
ctx.fill();
ctx.globalAlpha = 1;
if (h.phase === "idle") return;
const [lo, hi] = h.top ? [h.y, h.y + g.STORM_REACH] : [h.y - g.STORM_REACH, h.y];
const mid = h.col - round.scroll;
const col = mid - g.STORM_COL / 2;
if (h.phase === "warn") {
drawBand(ctx, col, (lo + hi) / 2, g.STORM_COL, hi - lo, DANGER, 0.2 + 0.2 * Math.abs(Math.sin(v.clock * 0.02)));
return;
}
drawBand(ctx, col, (lo + hi) / 2, g.STORM_COL, hi - lo, "#fff7b0", 0.5);
ctx.strokeStyle = "#ffffff";
ctx.lineWidth = 0.55;
ctx.beginPath();
for (let k = 0; k <= JAG_STEPS; k++) {
const t = k / JAG_STEPS;
const x = mid + (k === 0 ? 0 : (scatter(round.seed, Math.floor(h.beat) + k) - 0.5) * g.STORM_COL * 0.9);
const y = h.top ? lo + (hi - lo) * t : hi - (hi - lo) * t;
if (k) ctx.lineTo(x, y);
else ctx.moveTo(x, y);
}
ctx.stroke();
}
function drawHazards(ctx, v) {
const { g, round } = v;
for (const h of round.hazards) {
const sx = h.x - round.scroll;
if (h.kind === "gust") {
if (h.warnAt === undefined) continue;
if (h.live) drawGust(ctx, v, h, sx);
else drawGustWarning(ctx, v, h);
continue;
}
if (sx - h.w > g.FIELD_W || sx + h.w < 0) continue;
if (h.kind === "balloon") drawHotAir(ctx, sx, h.y, h.r);
else if (h.kind === "cluster") drawBunch(ctx, sx, h.y, h);
else if (h.kind === "kite") drawKite(ctx, v, h, sx, h.tipX - round.scroll);
else if (h.kind === "stream") drawStream(ctx, v, h, sx);
else if (h.kind === "storm") drawStorm(ctx, v, h, sx);
}
}
// The jet stream's glowing swirl ring, seen a little from the side. The last one
// has the smaller ring and the larger glow.
function drawPortal(ctx, v) {
const { portal, scroll, stage } = v.round;
const final = stage === v.g.MAX_STAGE;
const glow = final ? GLOW_FINAL : GLOW;
const rx = final ? RING_RX_FINAL : RING_RX;
const ry = portal.h / 2;
const sx = portal.x - scroll;
if (sx < -rx - glow * GLOW_STEPS || sx > v.g.FIELD_W + rx + glow * GLOW_STEPS) return;
ctx.strokeStyle = GOLD;
ctx.globalAlpha = 0.14;
for (let k = GLOW_STEPS; k >= 1; k--) {
ctx.lineWidth = 0.8 + k * glow;
ctx.beginPath();
ctx.ellipse(sx, portal.y, rx, ry, 0, 0, TAU);
ctx.stroke();
}
ctx.globalAlpha = 1;
ctx.lineWidth = 0.8;
ctx.beginPath();
ctx.ellipse(sx, portal.y, rx, ry, 0, 0, TAU);
ctx.stroke();
ctx.strokeStyle = "#fff7d6";
ctx.lineWidth = 0.35;
for (let k = 0; k < 4; k++) {
const from = v.clock * 0.005 + (k * TAU) / 4;
ctx.beginPath();
ctx.ellipse(sx, portal.y, rx * 0.68, ry * 0.92, 0, from, from + 1.1);
ctx.stroke();
}
}
// While the V forms: a faint gold line along each arm as the flock glides in.
function drawV(ctx, v) {
const { portal, flock, leader, scroll } = v.round;
if (!portal.v || !flock.length) return;
const ends = [flock[flock.length - 1], flock[Math.max(0, flock.length - 2)]];
if (typeof ends[0].x !== "number" || typeof ends[1].x !== "number") return;
ctx.globalAlpha = 0.5 * Math.max(0, Math.min(1, Math.min(portal.v.t, v.g.V_MS - portal.v.t) / V_FADE_MS));
ctx.strokeStyle = GOLD;
ctx.lineWidth = 0.4;
ctx.beginPath();
ctx.moveTo(ends[0].x - scroll, ends[0].y);
ctx.lineTo(leader.sx, leader.y);
ctx.lineTo(ends[1].x - scroll, ends[1].y);
ctx.stroke();
ctx.globalAlpha = 1;
}
// Loose birds fade through their last second, but stay faintly in sight as they
// fly off.
function drawScattered(ctx, v) {
const { round } = v;
for (const b of round.scattered) {
ctx.globalAlpha = Math.max(LOOSE_ALPHA_MIN, Math.min(1, (b.until - round.now) / 1000));
drawBird(ctx, b.x - round.scroll, b.y, 1.3, STRAY_COLOR, flapAt(v.clock, b.id * 1.7), STRAY_RIM);
}
ctx.globalAlpha = 1;
}
// A crate: a small box in its power's color with a soft glow.
function drawCrates(ctx, v) {
const { g, round } = v;
for (const c of round.crates) {
const sx = c.x - round.scroll;
if (sx < -CRATE_GLOW || sx > g.FIELD_W + CRATE_GLOW) continue;
const color = POWER_COLORS[c.kind];
ctx.globalAlpha = 0.3;
disc(ctx, sx, c.y, CRATE_GLOW, color);
ctx.globalAlpha = 1;
ctx.fillStyle = color;
ctx.fillRect(sx - CRATE_BOX / 2, c.y - CRATE_BOX / 2, CRATE_BOX, CRATE_BOX);
ctx.strokeStyle = FLOCK_COLOR;
ctx.lineWidth = 0.25;
ctx.strokeRect(sx - CRATE_BOX / 2, c.y - CRATE_BOX / 2, CRATE_BOX, CRATE_BOX);
}
}
// How far the magnet reaches, as a faint ring around the leader.
function drawMagnetRing(ctx, v) {
const { g, round } = v;
if (round.active.magnet <= 0 || !round.leader.alive) return;
ctx.globalAlpha = 0.35;
ctx.strokeStyle = POWER_COLORS.magnet;
ctx.lineWidth = 0.3;
ctx.beginPath();
ctx.arc(round.leader.sx, round.leader.y, g.MAGNET_REACH, 0, TAU);
ctx.stroke();
ctx.globalAlpha = 1;
}
// Speed streaks rushing away behind the last bird of the line.
function drawTailwind(ctx, v) {
const { round } = v;
if (round.active.tailwind <= 0 || !round.leader.alive) return;
const last = round.flock[round.flock.length - 1];
const tail = last && typeof last.x === "number" ? last : { x: round.leader.x, y: round.leader.y };
const x = tail.x - round.scroll - 2;
ctx.globalAlpha = 0.6;
ctx.strokeStyle = POWER_COLORS.tailwind;
ctx.lineWidth = 0.3;
for (let k = 0; k < WIND_STREAKS; k++) {
const back = (k * 5 + (v.clock / 1000) * WIND_RATE) % WIND_RUN;
const y = tail.y + (k - (WIND_STREAKS - 1) / 2) * 1.4;
ctx.beginPath();
ctx.moveTo(x - back, y);
ctx.lineTo(x - back - WIND_LEN, y);
ctx.stroke();
}
ctx.globalAlpha = 1;
}
function label(ctx, text, x, y, size, color, maxWidth) {
ctx.font = `800 ${size}px system-ui, -apple-system, "Segoe UI", sans-serif`;
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillStyle = color;
ctx.fillText(text, x, y, maxWidth);
}
// A strip across the field, its place chosen away from the leader, fading out
// at the end of its time and to see-through while anything is under it.
function drawBanner(ctx, v, b) {
const { g, round } = v;
const p = 1 - Math.max(0, b.until - round.now) / b.ms;
ctx.globalAlpha = (p > 0.82 ? Math.max(0, (1 - p) / 0.18) : 1) * b.see;
ctx.fillStyle = BANNER_SHADE;
ctx.fillRect(0, b.row - g.BANNER_HALF, g.FIELD_W, g.BANNER_HALF * 2);
label(ctx, b.text, g.FIELD_W / 2, b.row - 1, 4.2, b.color, g.FIELD_W - 4);
if (b.sub) label(ctx, b.sub, g.FIELD_W / 2, b.row + 3.2, 2.2, "#ffffff", g.FIELD_W - 4);
ctx.globalAlpha = 1;
}
// The end of a run, along the bottom of the field (the window's own message sits
// in the middle): how it went, the score, the best, and the nudge to go again.
function drawEnd(ctx, v, end) {
const { g } = v;
const top = g.FIELD_H - END_H;
const mid = g.FIELD_W / 2;
ctx.fillStyle = END_SHADE;
ctx.fillRect(0, top, g.FIELD_W, END_H);
const title = end.won ? (end.flawless ? `You made it! Flawless +${end.flawless}` : "You made it!") : "Out of lives";
label(ctx, title, mid, top + 2.8, 2.8, end.won ? GOLD : "#ffffff", g.FIELD_W - 4);
label(ctx, String(end.score), mid, top + 7.8, 6, GOLD, g.FIELD_W - 4);
label(ctx, end.fresh ? `A new best! ${end.best}` : `Best ${end.best}`, mid, top + 12.2, 2.2, "#ffffff", g.FIELD_W - 4);
label(ctx, end.teaser, mid, top + 15.6, 2.2, "#ffffff", g.FIELD_W - 4);
}
export function drawScene(ctx, v) {
const { g, round } = v;
ctx.save();
ctx.scale(v.u, v.u);
ctx.fillStyle = v.colors.board;
ctx.fillRect(0, 0, g.W, g.H);
drawHud(ctx, v);
ctx.translate(g.PAD, g.HUD_H);
ctx.save();
ctx.beginPath();
ctx.rect(0, 0, g.FIELD_W, g.FIELD_H);
if (typeof ctx.clip === "function") ctx.clip();
drawSky(ctx, v);
drawHazards(ctx, v);
drawPortal(ctx, v);
drawCrates(ctx, v);
drawMagnetRing(ctx, v);
drawTailwind(ctx, v);
drawV(ctx, v);
for (const s of round.strays) {
drawBird(ctx, s.x - round.scroll, s.y + Math.sin(v.clock * BOB_RATE + s.bob) * BOB, 1.3, STRAY_COLOR, flapAt(v.clock, s.bob), STRAY_RIM);
}
const { rim } = skyFor(round.stage);
for (const b of round.flock) {
if (typeof b.x === "number") drawBird(ctx, b.x - round.scroll, b.y, 1.4, FLOCK_COLOR, flapAt(v.clock, b.id * 1.7), rim);
}
drawScattered(ctx, v);
if (round.leader.alive || v.state === "over") drawLeader(ctx, v);
if (v.end) drawEnd(ctx, v, v.end);
else if (round.banner && round.banner.row !== null) drawBanner(ctx, v, round.banner);
ctx.restore();
ctx.translate(-g.PAD, -g.HUD_H);
drawPills(ctx, v);
ctx.restore();
}
@@ -0,0 +1,147 @@
// Plan2Code Web Console - flock: its own sound effects, merged into tones.js beside the shared kit; defines only.
//
// `tones` are one-shot sounds played with tone(name, level, pitch); `hums` are
// held sounds kept going with hum(id, name, level, pitch). Both take the shapes
// tones.js documents, as plain objects (tones.js freezes them). A name may be
// defined only once across tones.js and every game's file. No imports.
export default {
// The music: recorded songs, each a name to an mp3 the server serves (listed in
// SERVABLE), played by music.js one after another in the order flock.js deals them.
songs: {
flockSong1: "activities/flock-dash/1.mp3",
flockSong2: "activities/flock-dash/2.mp3",
flockSong3: "activities/flock-dash/3.mp3",
flockSong4: "activities/flock-dash/4.mp3",
flockSong5: "activities/flock-dash/5.mp3",
},
tones: {
// A stray picked up: a short, bright bird chirp (the game raises its pitch
// with the combo, so it stays soft and under a tenth of a second).
flockChirp: {
layers: [
{ type: "triangle", from: 1800, to: 2600, seconds: 0.07, gain: 0.25 },
{ type: "sine", from: 2400, to: 3200, seconds: 0.05, gain: 0.12 },
],
},
// A scattered bird picked back up: a softer, lower two-note chirp.
flockRejoin: {
layers: [{ type: "triangle", notes: [1047, 1319], seconds: 0.1, gain: 0.22 }],
},
// The line snapping: a plucked tone falling away, and a flutter of bandpassed noise.
flockSnap: {
layers: [
{ type: "triangle", from: 660, to: 220, seconds: 0.25, gain: 0.45, filter: { type: "lowpass", from: 2400, to: 500 } },
{ type: "noise", seconds: 0.03, gain: 0.3, filter: { type: "bandpass", from: 2500, to: 1800, q: 3 } },
{ type: "noise", seconds: 0.03, delay: 0.05, gain: 0.25, filter: { type: "bandpass", from: 2500, to: 1800, q: 3 } },
{ type: "noise", seconds: 0.03, delay: 0.1, gain: 0.2, filter: { type: "bandpass", from: 2500, to: 1800, q: 3 } },
],
},
// The leader hit: a thump and a squawk.
flockHit: {
layers: [
{ type: "sine", from: 150, to: 50, seconds: 0.15, gain: 0.8 },
{ type: "square", from: 500, to: 220, seconds: 0.15, gain: 0.3, filter: { type: "lowpass", from: 2000, to: 800 } },
],
},
// A shield soaking a hit: a bright metallic ping over a soft whoosh.
flockShield: {
layers: [
{ type: "sine", from: 2400, to: 2400, seconds: 0.35, gain: 0.3 },
{ type: "triangle", from: 3136, to: 3136, seconds: 0.25, delay: 0.02, gain: 0.15 },
{ type: "pink", seconds: 0.3, attack: 0.1, gain: 0.2, filter: { type: "bandpass", from: 700, to: 2600, q: 1.4 } },
],
},
// A crate opened: a sparkling rise.
flockPower: {
layers: [
{ type: "triangle", notes: [1047, 1319, 1568, 2093, 2637], seconds: 0.4, gain: 0.4 },
{ type: "sine", from: 2000, to: 4000, seconds: 0.4, gain: 0.15 },
],
},
// The gust warning: a rising whoosh of pink noise.
flockGust: {
layers: [{ type: "pink", seconds: 0.6, attack: 0.3, gain: 0.5, filter: { type: "bandpass", from: 200, to: 1400, q: 1.2 } }],
},
// The storm warning: a low crackle of noise.
flockThunder: {
layers: [
{ type: "brown", seconds: 0.5, gain: 0.6, filter: { type: "lowpass", from: 260, to: 140 } },
{ type: "noise", seconds: 0.04, delay: 0.1, gain: 0.3, filter: { type: "bandpass", from: 1200, to: 900, q: 2 } },
{ type: "noise", seconds: 0.04, delay: 0.22, gain: 0.25, filter: { type: "bandpass", from: 1200, to: 900, q: 2 } },
{ type: "noise", seconds: 0.04, delay: 0.32, gain: 0.3, filter: { type: "bandpass", from: 1200, to: 900, q: 2 } },
],
},
// Lightning striking: a sharp white crack with a low boom under it.
flockStrike: {
layers: [
{ type: "noise", seconds: 0.12, gain: 0.6, filter: { type: "highpass", from: 4000, to: 1500 } },
{ type: "sine", from: 90, to: 35, seconds: 0.5, gain: 0.8 },
{ type: "brown", seconds: 0.4, gain: 0.4, filter: { type: "lowpass", from: 300, to: 80 } },
],
},
// A portal passed: a whooshing shimmer.
flockPortal: {
layers: [
{ type: "sine", from: 500, to: 1500, seconds: 0.7, attack: 0.2, gain: 0.3, vibrato: { rate: 14, depth: 0.04 } },
{ type: "pink", seconds: 0.7, attack: 0.2, gain: 0.3, filter: { type: "bandpass", from: 400, to: 3000, q: 2 } },
],
},
// The V formed: a rising arpeggio of triangle notes.
flockV: {
layers: [{ type: "triangle", notes: [523, 659, 784, 1047], seconds: 0.4, gain: 0.5 }],
},
// A flawless stage: a bright little fanfare.
flockFlawless: {
layers: [
{ type: "triangle", notes: [784, 784, 988, 1319], seconds: 0.44, gain: 0.5 },
{ type: "square", notes: [392, 392, 494, 659], seconds: 0.44, gain: 0.25, filter: { type: "lowpass", from: 2400, to: 2400 } },
],
},
// A new stage: a clean four-note climb.
flockStage: {
layers: [
{ type: "triangle", notes: [523, 659, 784, 1047], seconds: 0.3, gain: 0.45 },
{ type: "square", notes: [262, 330, 392, 523], seconds: 0.3, gain: 0.15, filter: { type: "lowpass", from: 1600, to: 1600 } },
],
},
// A new best: a short sparkling run.
flockBest: {
layers: [
{ type: "triangle", notes: [1568, 2093, 2637, 3136, 2637, 3136], seconds: 0.3, gain: 0.4 },
{ type: "noise", seconds: 0.2, gain: 0.1, filter: { type: "highpass", from: 6000, to: 8000 } },
],
},
// Game over: a falling run.
flockOver: {
layers: [
{ type: "triangle", notes: [523, 466, 392, 330, 262], seconds: 0.6, gain: 0.5 },
{ type: "sawtooth", notes: [262, 233, 196, 165], seconds: 0.6, gain: 0.2, filter: { type: "lowpass", from: 900, to: 500 } },
],
},
// The run won: a longer, happy fanfare.
flockWin: {
layers: [
{ type: "triangle", notes: [523, 659, 784, 659, 784, 1047], seconds: 0.9, gain: 0.5 },
{ type: "square", notes: [262, 330, 392, 330, 392, 523], seconds: 0.9, gain: 0.25, filter: { type: "lowpass", from: 2400, to: 2400 } },
],
},
},
hums: {
// The wind past the flock: soft filtered pink noise; pitch follows flight speed.
// Kept under the music, so it stays quiet.
flockWind: {
noise: { color: "pink", gain: 1 },
filter: { type: "bandpass", freq: 500, q: 0.8, follow: 1 },
pulse: { rate: 0.3, depth: 0.3 },
peak: 0.015,
},
// Riding a slipstream: a faster, brighter rush with a light pulse.
flockStream: {
noise: { color: "pink", gain: 1 },
filter: { type: "bandpass", freq: 1400, q: 1.2, follow: 1 },
pulse: { rate: 6, depth: 0.4 },
peak: 0.02,
},
},
};
File diff suppressed because it is too large. Load diff
+22 -5
View File
@@ -2650,13 +2650,13 @@
<p class="help-lead">
The <strong>die</strong> in the top bar opens
<strong>Activities</strong>: small games to play while you wait, say
through a long build. Twelve games ship: <strong>Snake</strong>,
through a long build. Thirteen games ship: <strong>Snake</strong>,
<strong>Mini golf</strong>, <strong>Light Trails</strong>,
<strong>Bug Hunt</strong>, <strong>Sunset Drive</strong>,
<strong>Stack Deploy</strong>, <strong>Bumper Ring</strong>,
<strong>Rapids Run</strong>, <strong>Hot Potato</strong>,
<strong>Crossing Rush</strong>, <strong>Bounce Road</strong> and
<strong>Ghoul Rush</strong>. The window opens on a card for each game, with its best score; click one
<strong>Crossing Rush</strong>, <strong>Bounce Road</strong>,
<strong>Ghoul Rush</strong> and <strong>Flock Dash</strong>. The window opens on a card for each game, with its best score; click one
(or walk them with the arrows and press <kbd>Space</kbd>) to play it,
and <strong>All games</strong> takes you back. One game plays at a
time: a round left for the cards waits, paused, on its card, and
@@ -2959,6 +2959,18 @@
lost; and 2000 for the Gourd and 2500 for Rattlebones, times the
lap, with a life back.
</li>
<li>
<strong>Flock Dash</strong>: lead Planny's flock through a sunset
sky. Strays drift in from the right; fly into one and it joins the
flock, following the exact path you flew. Balloons, gusts,
slipstreams, storm clouds and kites are in the way: a hit on the
leader costs one of three lives, and a hit on the line snaps it
there, scattering the birds behind (pick them back up within 3
seconds or they are gone). Eight stages, each ending at a jet
stream portal that forms a V for a bonus when enough birds reach
it; the final portal moves. Tailwind, shield and magnet crates help,
and quick pickups build a combo of up to x5.
</li>
</ul>
<h4>It never hides your turn</h4>
<ul>
@@ -3052,6 +3064,11 @@
<kbd>Space</kbd> to fire (in bursts: the blaster slows as it heats
and cools once you let go).
</li>
<li>
Flock Dash: up and down (or <kbd>W</kbd> and <kbd>S</kbd>) climb and
dive, left and right (or <kbd>A</kbd> and <kbd>D</kbd>) ease forward
and back.
</li>
<li><kbd>Space</kbd> starts a round, and plays again after a pause.</li>
<li><kbd>P</kbd> pauses and plays.</li>
<li><kbd>R</kbd> starts the round over, from the countdown.</li>
@@ -3076,7 +3093,7 @@
<p>
The window's title shows the best for the game on screen, and the
line under the board shows it beside your score, and each card shows
its game's. For Snake, Light Trails, Bug Hunt, Sunset Drive, Stack Deploy, Bumper Ring, Rapids Run, Hot Potato, Crossing Rush, Bounce Road and Ghoul Rush the best is
its game's. For Snake, Light Trails, Bug Hunt, Sunset Drive, Stack Deploy, Bumper Ring, Rapids Run, Hot Potato, Crossing Rush, Bounce Road, Ghoul Rush and Flock Dash the best is
your highest score; for Mini golf it is your lowest full round of eighteen holes,
kept for each course on its own, and a round left halfway never counts. <strong>Reset best
scores</strong>, at the bottom of the window, clears them all after a
@@ -3091,7 +3108,7 @@
its own <strong>Music</strong> slider under the board for how loud it plays.
</p>
<p>
Best scores, Snake's surprises found, Light Trails' furthest arena, Bug Hunt's finds, Sunset Drive's roads found, Stack Deploy's highest floor, Bumper Ring's furthest arena, Rapids Run's furthest dam, Hot Potato's furthest venue, Crossing Rush's furthest zone, Bounce Road's furthest stage, Ghoul Rush's furthest room, each game's music volume, your last pick and that switch are saved privately on
Best scores, Snake's surprises found, Light Trails' furthest arena, Bug Hunt's finds, Sunset Drive's roads found, Stack Deploy's highest floor, Bumper Ring's furthest arena, Rapids Run's furthest dam, Hot Potato's furthest venue, Crossing Rush's furthest zone, Bounce Road's furthest stage, Ghoul Rush's furthest room, Flock Dash's furthest stage, each game's music volume, your last pick and that switch are saved privately on
this machine, with your other preferences, and never sent anywhere.
</p>
</section>
@@ -907,6 +907,22 @@ const COVERS = Object.freeze({
["rect", { x: 59, y: 49.4, width: 6, height: 6, rx: 1.5, fill: "none", "stroke-width": 0.8, class: "cv-ink3-line" }],
["path", { d: "M62.0 50.0 L62.6 51.5 L64.2 51.6 L63.0 52.6 L63.4 54.2 L62.0 53.3 L60.6 54.2 L61.0 52.6 L59.8 51.6 L61.4 51.5 Z", class: "cv-accent" }],
],
flock: [
...[0, 1, 2, 3, 4, 5].map((k) => ["rect", { y: k * 10, width: 120, height: 10, fill: ["#4b2a7a", "#6a3b8f", "#944a9c", "#c75b93", "#ec6f7a", "#f5965c"][k] }]),
["circle", { cx: 90, cy: 58, r: 8, fill: "#fff3b0" }],
["rect", { y: 60, width: 120, height: 12, fill: "#f7c35e" }],
...[[8, 22], [18, 28], [28, 24], [38, 30], [48, 34]].map(([x, y]) => ["path", { d: "M-5 0 Q-2.5 -4 0 -0.5 Q2.5 -4 5 0 Q2.5 -1.5 0 1.5 Q-2.5 -1.5 -5 0 Z", transform: `translate(${x} ${y})`, fill: "#2b2140" }]),
["path", { d: "M96 6 Q106 6 106 18 Q106 30 98 36 H94 Q86 30 86 18 Q86 6 96 6 Z", fill: "#e2553f", stroke: "#2b2140", "stroke-width": 1 }],
["rect", { x: 91, y: 9, width: 3, height: 23, fill: "#f4f1ea" }],
["rect", { x: 98, y: 9, width: 3, height: 23, fill: "#f4f1ea" }],
["path", { d: "M94 36 L93 39 M98 36 L99 39", stroke: "#2b2140", "stroke-width": 0.8 }],
["rect", { x: 92.5, y: 39, width: 7, height: 4.5, rx: 1, fill: "#8a5a30" }],
["rect", { transform: "translate(36 6)", x: 20, y: 28, width: 28, height: 22, rx: 9, class: "cv-accent" }],
["path", { transform: "translate(36 6)", d: "M47 34 L53 37 L47 40 Z", fill: "#ff8a1f" }],
["path", { transform: "translate(36 6)", d: "M24 40 Q32 47 42 40 Q36 46 24 44 Z", fill: "#000000", "fill-opacity": 0.22 }],
["path", { transform: "translate(36 6)", d: "M34 31.4 L34.9 33.8 L37.4 33.9 L35.4 35.5 L36.1 37.9 L34 36.5 L31.9 37.9 L32.6 35.5 L30.6 33.9 L33.1 33.8 Z", fill: "#f5b301" }],
["path", { transform: "translate(36 6)", d: "M28 50 V53 H31 M37 50 V53 H40", fill: "none", "stroke-width": 1.6, "stroke-linecap": "round", "stroke-linejoin": "round", class: "cv-accent-line" }],
],
fuse: [
["rect", { width: 120, height: 72, fill: "#dcc9a6" }],
...[0, 1, 2, 3, 4, 5].flatMap((r) => [0, 1, 2, 3, 4, 5, 6, 7].filter((c) => (c + r) % 2).map((c) => ["rect", { x: c * 16, y: r * 12, width: 16, height: 12, fill: "#d1bc95" }])),
+2 -1
View File
@@ -13,6 +13,7 @@ import fuseSfx from "./activities/fuse-sfx.js";
import hopSfx from "./activities/hop-sfx.js";
import bounceSfx from "./activities/bounce-sfx.js";
import ghoulSfx from "./activities/ghoul-rush/sfx/ghoul-sfx.js";
import flockSfx from "./activities/flock-sfx.js";
/* ------------------------------------------------------------- tones
@@ -376,7 +377,7 @@ const HUMS = hums({
// Every game's own extras, merged after the shared kit; a name may be
// defined only once across them all (the activities suite checks).
const GAME_SFX = Object.freeze([snakeSfx, golfSfx, trailsSfx, bugsSfx, driveSfx, stackSfx, bumperSfx, rapidsSfx, fuseSfx, hopSfx, bounceSfx, ghoulSfx]);
const GAME_SFX = Object.freeze([snakeSfx, golfSfx, trailsSfx, bugsSfx, driveSfx, stackSfx, bumperSfx, rapidsSfx, fuseSfx, hopSfx, bounceSfx, ghoulSfx, flockSfx]);
// A game file holds plain objects; they are frozen here, all the way down.
const deepFreeze = (o) => {
+5
View File
@@ -231,6 +231,11 @@ export const SERVABLE = new Set([
"activities/light-trails/3.mp3",
"activities/light-trails/4.mp3",
"activities/light-trails/5.mp3",
"activities/flock-dash/1.mp3",
"activities/flock-dash/2.mp3",
"activities/flock-dash/3.mp3",
"activities/flock-dash/4.mp3",
"activities/flock-dash/5.mp3",
"activities/bugs-sfx.js",
"activities/drive-sfx.js",
"activities/stack-sfx.js",