Skip to content

Commit

Permalink
Merge pull request #991 from ericrosenbaum/bugfix/clones-share-active…
Browse files Browse the repository at this point in the history
…soundplayers

Clones share their parent’s activeSoundPlayers object
  • Loading branch information
ericrosenbaum committed Mar 22, 2018
2 parents 2b985fa + 2527c80 commit 4e3c5c7
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/sprites/rendered-target.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,13 @@ class RenderedTarget extends Target {
this.audioPlayer = null;
if (this.runtime && this.runtime.audioEngine) {
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;
}
}
}
}

Expand Down

0 comments on commit 4e3c5c7

Please sign in to comment.