mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-25 15:32:40 -05:00
move playsound function to target
This commit is contained in:
parent
d5e0d433aa
commit
4e57ab561d
2 changed files with 5 additions and 2 deletions
|
@ -39,12 +39,12 @@ Scratch3SoundBlocks.prototype.getPrimitives = function () {
|
||||||
|
|
||||||
Scratch3SoundBlocks.prototype.playSound = function (args, util) {
|
Scratch3SoundBlocks.prototype.playSound = function (args, util) {
|
||||||
var index = this._getSoundIndex(args.SOUND_MENU, util);
|
var index = this._getSoundIndex(args.SOUND_MENU, util);
|
||||||
util.target.audioPlayer.playSound(index);
|
util.target.playSound(index);
|
||||||
};
|
};
|
||||||
|
|
||||||
Scratch3SoundBlocks.prototype.playSoundAndWait = function (args, util) {
|
Scratch3SoundBlocks.prototype.playSoundAndWait = function (args, util) {
|
||||||
var index = this._getSoundIndex(args.SOUND_MENU, util);
|
var index = this._getSoundIndex(args.SOUND_MENU, util);
|
||||||
return util.target.audioPlayer.playSound(index);
|
return util.target.playSound(index);
|
||||||
};
|
};
|
||||||
|
|
||||||
Scratch3SoundBlocks.prototype._getSoundIndex = function (soundName, util) {
|
Scratch3SoundBlocks.prototype._getSoundIndex = function (soundName, util) {
|
||||||
|
|
|
@ -465,6 +465,9 @@ RenderedTarget.prototype.updateAllDrawableProperties = function () {
|
||||||
this.runtime.spriteInfoReport(this);
|
this.runtime.spriteInfoReport(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
RenderedTarget.prototype.playSound = function (index) {
|
||||||
|
return this.audioPlayer.playSound(this.sprite.sounds[index].md5);
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* Return the human-readable name for this rendered target, e.g., the sprite's name.
|
* Return the human-readable name for this rendered target, e.g., the sprite's name.
|
||||||
* @override
|
* @override
|
||||||
|
|
Loading…
Reference in a new issue