mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-01-11 10:39:56 -05:00
Clones get ref to parent’s activeSoundPlayers obj
This commit is contained in:
parent
4c0e968bec
commit
2527c804ea
1 changed files with 7 additions and 0 deletions
|
@ -146,6 +146,13 @@ class RenderedTarget extends Target {
|
||||||
this.audioPlayer = null;
|
this.audioPlayer = null;
|
||||||
if (this.runtime && this.runtime.audioEngine) {
|
if (this.runtime && this.runtime.audioEngine) {
|
||||||
this.audioPlayer = this.runtime.audioEngine.createPlayer();
|
this.audioPlayer = this.runtime.audioEngine.createPlayer();
|
||||||
|
// If this is a clone, it gets a reference to its parent's activeSoundPlayers object.
|
||||||
|
if (!this.isOriginal) {
|
||||||
|
const parent = this.sprite.clones[0];
|
||||||
|
if (parent && parent.audioPlayer) {
|
||||||
|
this.audioPlayer.activeSoundPlayers = parent.audioPlayer.activeSoundPlayers;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue