Skip to content

Power-up drops: Magnet, Double Jump, Bubble Shield - #8

Merged
cmalpass merged 1 commit into
mainfrom
cmalpass-potential-enigma
Aug 27, 2026
Merged

Power-up drops: Magnet, Double Jump, Bubble Shield#8
cmalpass merged 1 commit into
mainfrom
cmalpass-potential-enigma

Conversation

@cmalpass

Copy link
Copy Markdown
Owner

What

Stomped enemies now drop a glowing capsule on a 25% roll, introducing three timed power-ups:

  • Magnet (8 s) — crystals within 150 px home in at 520 px/s
  • Double Jump (15 s) — one extra air jump (600 px/s), resets on landing
  • Bubble Shield — absorbs the next hit with a pop, grants half-invulnerability, no heart lost

Capsules bob and glow in the world, blink during their final 2 seconds, and evaporate with a particle poof after 10 s. Active effects render as HUD chips under the heart panel (icon + draining timer bar). New SFX: rising power-up chime and bubble pop. Effects clear on respawn; capsules left in the field persist until expiry.

Implementation

  • src/powerup.ts (new) — drop table (rollDrop, single injectable rng draw decides drop + type uniformly), capsule entity, shared icon renderer
  • src/player.ts — magnet/double-jump/bubble state, air double-jump branch, magnet in the crystal loop, capsule pickup, bubble absorb in damage() (after god-mode check), stomp drop hook
  • src/level.ts — capsule array, spawn, update (collect/expiry), reset
  • src/config.tsCFG.powerup tuning block
  • src/audio.tspowerup + bubblePop SFX
  • src/game.ts — world render + HUD chips

Validation (local gate — CI is failing for pre-existing unrelated reasons)

  • npm run typecheck
  • npm test193 passed (175 baseline + 18 new) ✓
  • npm run build ✓ (128.96 kB / 39.66 kB gzip, single file)
  • npm run lint
  • Headless Playwright E2E: HUD chips with all 3 active effects; magnet pulls and collects a real crystal; double jump sets airJumps with correct impulse; bubble absorbs a hit (hearts 3→3, invulnT set); forced stomp drop → capsule → same-frame pickup → fresh magnet timer (stomps: 1); field capsule screenshot. Zero page errors.

Screenshots: /tmp/tinyrex-e2e/01-hud-chips.png06-capsule-field.png

Stomped enemies now drop a glowing capsule on a 25% roll (single
injectable Math.random draw decides drop + type uniformly):
- Magnet (8 s): crystals within 150px home in at 520px/s
- Double Jump (15 s): one extra air jump, 600px/s impulse, resets on landing
- Bubble Shield: absorbs the next hit, grants half invulnerability, no heart lost

Capsules bob and glow in the world, blink in their final 2 seconds, and
evaporate with a poof after 10 s. Active effects show as HUD chips under
the heart panel with icon + draining timer bar. New SFX: power-up chime
and bubble pop. Effects clear on respawn; field capsules persist.

18 new unit tests (roll table, capsule lifecycle, magnet pull/expiry,
double-jump state machine, bubble absorption); headless E2E verified all
three effects plus the full stomp-drop-to-pickup chain, zero page errors.
@cmalpass
cmalpass merged commit bb8fb7f into main Aug 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant