You are browsing as a guest. Sign up (or log in) to start making projects!

9h 18m 59s logged

Added an audio system using the WebAudio API. No external sound files everything is generated programmatically using oscillators and gain nodes. Each game event has its sound: a short square wave blip for eating dots a sawtooth drop for eating pellets, a triangle tone for eating ghosts a descending three-note jingle for death and a rising three-note fanfare for level complete.

The main menu has a looping chiptune melody. 25 Notes scheduled ahead of time using ctx.currentTime, which avoids timing drift that would happen with repeated setTimeout calls. It loops by scheduling the playthrough when the current one ends.

The trickiest part was the browser autoplay policy. Browsers block AudioContext from making sound until the user interacts with the page. The fix was checking ctx.state === suspended on the click and calling ctx.resume() before trying to play anything.

Finished power-up effects. Freeze and slow work via frame timers (_frozenTimer _slowTimer) set directly on each monster. The monster update method checks these at the top before doing anything effectively pausing or slowing it without touching core movement logic.

Known issue: menu music doesn’t stop immediately when the game starts. There’s a 1-2 overlap before it cuts out. Will fix session along with, in-game sound effects not always triggering. Investigating AudioContext state management across the menu-> game transition.

0
11

Comments 0

No comments yet. Be the first!