play Until Done

Play a built-in melody until it finishes.

music.baDing.playUntilDone()

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 playUntilDone function from that instance of the melody, just like this:

music.baDing.playUntilDone()

The part of your program that calls playUntilDone will wait until the melody is finished playing. After the melody is done playing, your code will continue to run. If you want the code that follows the playUntilDone function to continue immediately, you can use play instead.

To understand how melodies are created for use in arcade, take a look at the developer sound page.

Parameters

  • volume: an optional sound volume for playing the melody. The volume range is from 0 to 255. The default volume value is 128.

Examples

I’ll play ‘BaDing’

Play a the built-in sound called BaDing.

music.baDing.playUntilDone()

Play ‘Power Up’ at a low volume

Play the power up sound at a volume of 75.

music.powerUp.playUntilDone(75)

See also

play, loop, stop

mixer