Skip to content

Commit

Permalink
blocked play of mass collision sound if mass was pushed, see #181
Browse files Browse the repository at this point in the history
  • Loading branch information
jbphet committed Nov 13, 2019
1 parent 7bd10c1 commit ec5d07b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions js/gravity-force-lab/view/MassBoundarySoundGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@ define( require => {

// function for playing the appropriate boundary sound
const positionListener = position => {
if ( position === model.getObjectMinPosition( movableObject ) ) {
massSidePosition === 'left' ? outerBoundarySoundClip.play() : innerBoundarySoundClip.play();
}
else if ( position === model.getObjectMaxPosition( movableObject ) ) {
massSidePosition === 'left' ? innerBoundarySoundClip.play() : outerBoundarySoundClip.play();
if ( !model.massWasPushed() ) {
if ( position === model.getObjectMinPosition( movableObject ) ) {
massSidePosition === 'left' ? outerBoundarySoundClip.play() : innerBoundarySoundClip.play();
}
else if ( position === model.getObjectMaxPosition( movableObject ) ) {
massSidePosition === 'left' ? innerBoundarySoundClip.play() : outerBoundarySoundClip.play();
}
}
};
movableObject.positionProperty.link( positionListener );
Expand Down

0 comments on commit ec5d07b

Please sign in to comment.