Commit Graph

13 Commits

Author SHA1 Message Date
Brian Fertig 1eea919c8b Add flour bonus item type with custom firework variant
- Extend bonus items spritesheet from 9 to 12 frames (add flour + 2 firework objects)
- Add `flour` type to BONUS_ITEM config with warm off-white/tan color palette and firework variant (2-3x scale, half opacity for dust cloud effect)
- Implement per-type firework variants in BonusItemManager._explode() - particles can now have varied sizes and alpha while maintaining standard physics body size
- Add flour SFX asset (bonus-flour.mp3) and preload it
- Update editor to support placing flour bonus items with appropriate icon, color, and sprite frame
- Update all documentation (README, sprites.md) to reflect the new bonus item type

Additionally:
- Add campaign 2 bus physics customization: grippier tires (higher friction coefficients) and stiffer/less-damped suspension for bouncier ride
- Thread per-campaign wheel friction and suspension parameters through Bus entity from themes.js
- Redesign level11 with shorter course, fewer kids (4 vs 3), tighter time limit (42s vs 119s), and flour bonus items replacing most cash/CTC/guitar
2026-08-23 19:27:10 -06:00
Brian Fertig a728a51cd2 Level updates and campaign 2 assets 2026-08-23 16:20:26 -06:00
Brian Fertig fba3ed040d Add halfpipe and reverseHalfpipe section generators
- Register `halfpipe` and `reverseHalfpipe` in SECTION_TYPES and GENERATORS
- Implement both as single cubic Bezier curves with vertical tangents at entrance/exit:
  - halfpipe: near-vertical drop into a rounded bottom, then a shorter climb; exit ends below entrance (net decline)
  - reverseHalfpipe: vertical mirror of halfpipe — short rise arcing up and over, then a longer drop; exit also ends below entrance
- Use monotonic x(t) = W * t^2 * (3 - 2t) to keep terrain valid as y(x)
- Sample each profile with 24 points and snap endpoints exactly for seamless section joins
- Scale vertical magnitudes by vScale; chosen defaults yield ~350 base-unit drop and ~210 net decline at default width
2026-08-23 13:57:18 -06:00
Brian Fertig 864e76098a Smooth washboard section: half-sine arches instead of spiky zig-zag 2026-08-23 12:56:34 -06:00
Brian Fertig 3be7b857ed Add washboard section types (flat / up / down) to the level editor 2026-08-23 12:46:35 -06:00
Brian Fertig b087d91f4f feat: add bonus items (CTC box / guitar / cash) with firework burst on collection
Introduces a new "bonus item" system alongside the existing smashables:

- **Gameplay**: Floating collectible prizes (CTC box, guitar, cash) that the bus passes through with zero physical response. On first contact, the item pops (scale-up + fade) and spawns a radial burst of tinted firework particles that arc down under gravity, settle on terrain, and fade out. Each collected item scores 100 points on the end-of-level tally.
- **Config**: `BONUS_ITEM` in `config.js` holds all tuning knobs (particle count, speed range, spin, lifetime, per-type tint palette, pop scale/duration). `SCORE.perBonusItem` added.
- **Entity**: New `BonusItemManager` class owns static sensor bodies for each bonus item, detects bus collisions, and orchestrates the pop + firework burst animation. Particles are real Matter bodies exempted from bus/kid collision so they can land on terrain without affecting gameplay.
- **Editor**: "Smashables" section renamed to "Placeables" with a kind toggle (Smashables vs Bonus items). Bonus items are float-only with no gravity option. Preview map, click-to-place, item list, and export all support both kinds. `splitPlaceables()` in `levelBuilder.js` splits the unified editor list into the two level arrays (`items` / `bonusItems`).
- **Levels**: Levels 2–6 updated with bonus item placements (and some additional smashable items).
- **Assets**: New `bonus-items.png` spritesheet (9 frames: 3 bonus items × [item + 2 firework objects]) registered in the asset manifest.
- **Score screen**: `_revealBonus()` method in `LevelScoreScene` displays collected bonus count and points, skipped when zero.
2026-08-22 19:00:55 -06:00
Brian Fertig f4b89a25df Add smashable props (TV/chair/cone) with physics-based launch on bus collision
- New SmashItemManager entity that spawns items from level data, detects bus contact, swaps to smashed frame, and applies up-and-forward impulse with tumble
- Add `SMASH_ITEM` config block for launch speed/angle/spin, density, friction, restitution, and float height
- Extend asset manifest and spritesheet (6 frames: intact/smashed TV, chair, cone)
- Level editor gains "Smashables" section to place/delete items via click on preview map; exports `items` array in level data
- Level editor can now import bundled or file-based levels, preserving exact terrain while locking section editing; metadata and items remain editable for re-export
- Score scene reveals smashed item count as a bonus line (+50 each) between kids and time tally
- PlayScene wires SmashItemManager lifecycle and passes smashedCount to score scene
- README documents smashables feature, editor workflow, and import behavior
2026-08-22 14:56:02 -06:00
Brian Fertig d6e998027b Add smashable props (TV/chair/cone) with physics-based launch on bus collision
- New SmashItemManager entity that spawns items from level data, detects bus contact, swaps to smashed frame, and applies up-and-forward impulse with tumble
- Add `SMASH_ITEM` config block for launch speed/angle/spin, density, friction, restitution, and float height
- Extend asset manifest and spritesheet (6 frames: intact/smashed TV, chair, cone)
- Level editor gains "Smashables" section to place/delete items via click on preview map; exports `items` array in level data
- Level editor can now import bundled or file-based levels, preserving exact terrain while locking section editing; metadata and items remain editable for re-export
- Score scene reveals smashed item count as a bonus line (+50 each) between kids and time tally
- PlayScene wires SmashItemManager lifecycle and passes smashedCount to score scene
- README documents smashables feature, editor workflow, and import behavior
2026-08-22 14:55:50 -06:00
Brian Fertig f298dc513c feat(editor): add new terrain section types and fix physics body generation
Add four new section types to the level editor:
- dropOff: instant vertical drop with gentle downward tail
- gap: flat lead-in, x-gap, flat landing at same height
- lip: flat run into a steepening (t²) kicker ramp
- dropGap: like gap but landing is well below takeoff

Fix Terrain physics body generation to extrude straight down from
segment endpoints instead of using rotated rectangles. A previous
perpendicular-offset approach caused near-vertical segments (dropOff
cliffs) to balloon physics bodies sideways under adjacent terrain,
making the bus ride above the drawn ground.

Update level03 ("Mind the Gap") to use editor-generated terrain data.
Generalize levelBuilder smoothing to detect gap-shaped sections
(structurally via takeoffPoints/landingPoints) rather than by type
string, so future gap types work automatically.
2026-08-20 16:32:20 -06:00
Brian Fertig ef47daea6d feat(editor): improve level preview and auto-calculate time limits
- Fix terrain preview aspect ratio to match in-game rendering by using
  consistent X/Y scaling, preventing slopes from appearing distorted
- Calculate timeLimit automatically based on level length and pace
  (TIME_LIMIT_PACE) to ensure consistent difficulty scaling across levels
- Add max-height and vertical scrolling to the level preview panel
- Generate level02 (The Big Jump) from the editor with manual tweak
2026-08-20 12:38:21 -06:00
Brian Fertig 3b8c13fb4e feat: complete level 01, engine audio, menu music, editor enhancements
- Implement EngineSound system that pitches engine-heavy.mp3 based on rear
  wheel angular velocity, with rate smoothing to avoid stair-stepping
- Add continuous menu music across Intro → MainMenu → LevelSelect scenes
- Add per-level voice-over support (level01: "Get the Money!")
- Redesign level01 with hand-crafted terrain sections (Flat, Incline,
  Jump, Roller, Descent, Bumps, Flat, Descent, Bumps, Flat)
- Editor: per-section width and vertical scale (vScale) controls
- Editor: smooth entry blending between sections using angle-based
  interpolation (avoids slope overshoot from naive height blending)
- Editor: new size-panel UI with range/number inputs and smooth checkbox
- Fix KidManager re-boarding: ejected kids must be settled before
  re-boarding to prevent mid-air teleportation
- Load audio assets in PreloadScene; handle missing voice files gracefully
2026-08-20 10:10:19 -06:00
Brian Fertig 9892df762c Rework ejection feel, parallax backgrounds, and camera bounds
- Ejection: drop GFORCE.ejectThresholdG from 6 to 0.5 - the bouncier
  suspension isolates the chassis from shock, so the old threshold was
  effectively unreachable and kids were never actually being ejected.
  Ejected kids now pop straight up through the roof (ignoring chassis
  velocity/tilt) and fly under a lighter gravity (KID.ejectedGravityScale
  0.35, applied via KidManager's beforeupdate handler) for a floaty,
  Snuggle-Truck-style arc.
- Cut maxLeanAngularVelocity and leanTorqueStep in half for a slower,
  more gradual lean that's easier to fine-tune mid-air.
- Parallax: far layer is now screen-fixed, scaled uniformly (no stretch),
  and pans exactly once from start to goal by level progress; mid/near
  layers are bottom-anchored and tiled at their own uniform scales. Kids
  render at depth -1 so the bus always draws over them.
- Level builder: size camera bounds to the level's actual terrain min/max
  Y (with padding, 1000px floor) instead of a fixed 1000 height, so long
  runs of declines no longer push the bus below the camera's reach.
- Add level 04 "Mega Drop" (5 kids, extended terrain ending in the mega
  drop sequence).
2026-08-19 20:58:01 -06:00
Brian Fertig 4973b22f7c Add level editor and retune physics/camera for bouncier, floatier driving
- New browser level editor (editor.html + src/editor/): assemble levels
  from snap-together section generators (flat/inclines/hills/ditch/jump)
  with a live canvas preview, metadata form, and export to ready-to-drop
  levelNN.js source; example export registered as level04.js.
- Add parallax background sprites (bg_far/mid/near).
- Bus retune: softer, bouncier suspension (stiffness 0.45->0.35, damping
  0.08->0.035, travel 12->30, restitution 0.3->0.45) with wheel rest
  point raised 22->34 for a bouncier stance; drive force cut ~60%
  (0.011->0.0045) for a much longer runway and lower top speed.
- Gravity 1 -> 0.675 for ~1.5x hang time off jumps; constraintIterations
  2 -> 10 so the soft wishbone springs converge within one step.
- Bus: clamp each wheel to the underside of its wishbone anchor line on
  every matter afterupdate, fixing wheels punching through to the
  mirrored solution and sticking high on the chassis after hard impacts;
  add no-op destroy() for the world listener.
- CameraRig: speed-driven horizontal lookahead (bus framed ~10% from the
  left edge at rest, out to 1/3 of the screen at speed) via followOffset;
  PlayScene scales the g-force grace period to 5.5s for the new gravity
  and calls the new update()/destroy() hooks.
- Extend level01's terrain runway by 30x.
2026-08-19 20:07:24 -06:00