From ec5d07bfcd4c67e8a96313ef3468d2c9719d0ea4 Mon Sep 17 00:00:00 2001 From: jbphet Date: Wed, 13 Nov 2019 13:26:18 -0700 Subject: [PATCH] blocked play of mass collision sound if mass was pushed, see #181 --- .../view/MassBoundarySoundGenerator.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/js/gravity-force-lab/view/MassBoundarySoundGenerator.js b/js/gravity-force-lab/view/MassBoundarySoundGenerator.js index 3f488390..67ba26b5 100644 --- a/js/gravity-force-lab/view/MassBoundarySoundGenerator.js +++ b/js/gravity-force-lab/view/MassBoundarySoundGenerator.js @@ -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 );