Play a built-in melody.
music.baDing.play()
There are several built-in melodies which you can play in your game. When using blocks, a melody is chosen from a dropdown list. In JavaScript, an instance of one of the built-in melodies is referenced in your code. You call the play function from that instance of the melody, just like this:
music.baDing.play()
Your program continues immediately after the melody begins playing. If you want the code that follows the play function to wait, you can use playUntilDone instead.
To understand how melodies are created for use in arcade, take a look at the developer sound page.
- volume: an optional sound volume for playing the melody. The volume range is from
0
to255
. The default volume value is128
.
Play a the built-in sound called BaDing
.
music.baDing.play()
Play the power up
sound at a volume of 255
.
music.powerUp.play(255)
mixer