Skip to content

4. Sound and Music

fowluhhdevbcfunny edited this page Jun 17, 2024 · 1 revision

To play music, you define the variable and call play like so:

this.music = new Music("path/to/your/song.wav");
this.music.play();

To stop the music, call stop:

this.music.stop();

To play a sound effect, we do what we did for the music:

this.sound = new Sound("path/to/your/sound.wav");
this.sound.play();

NOTE: You cannot call stop on a sound.

Clone this wiki locally