Separate blocks for 'play sound' and 'play sound until done'

This commit is contained in:
Caitlin Hennessy
2017-11-30 15:49:50 -08:00
parent c6bae5e17b
commit aa636aef96
4 changed files with 19 additions and 25 deletions

View File

@ -260,11 +260,10 @@ namespace music {
* Plays a sound
* @param sound the sound to play
*/
//% blockId=music_play_sound_effect block="play %sound"
//% blockId=music_play_sound_until_done block="play sound %sound|until done"
//% weight=98
export function playSoundEffect(sound: Sound) {
export function playSoundUntilDone(sound: Sound) {
if (!sound) return;
sound.play();
}
@ -277,4 +276,14 @@ namespace music {
export function _soundPicker(sound: Sound): Sound {
return sound;
}
/**
* Start playing a sound and don't wait for it to finish.
* @param sound the sound to play
*/
//% blockId=music_play_sound block="play sound %sound"
//% weight=99
export function playSound(sound: Sound) {
control.runInBackground(() => sound.play());
}
}