Closed KatieWoe closed 6 years ago
This has not been a problem in the past, and this sim has had no changes. So I suspect that it's related to @jbphet's recent changes to sound. Let's get him involved.
@KatieWoe Does this problem occur in other sims that have a similar reward screen? E.g. run BCE master with ?showAnswers
, play a perfect game, and see if the sound plays before the reward is displayed.
+1 on what @pixelzoom just said - it will save me time in tracking this down if we know whether it happens on other sims on master as well as currently published sims.
Just tested this on BCE master. It doesn't seem to occur, or if it does the victory screen appeared quickly enough that I didn't notice it.
Playing the game reward sound (cheer.mp3) is initiated by sim-specific code, by calling gameOverPerfectScore
in VEGAS/GameAudioPlayer
, and should do so after showing the reward.
BCE has things in the correct order. See GameScreenView
line 106:
// game reward, shown for perfect score (or with 'reward' query parameter)
if ( this.model.isPerfectScore() || BCEQueryParameters.showReward ) {
this.rewardNode = new BCERewardNode( level );
this.rootNode.addChild( this.rewardNode );
}
...
// Play the appropriate audio feedback.
if ( this.model.isPerfectScore() ) {
this.audioPlayer.gameOverPerfectScore();
}
else {
this.audioPlayer.gameOverImperfectScore();
}
RPAL does things in the incorrect order. See ResultsNode
line 43:
if ( model.isPerfectScore() ) {
audioPlayer.gameOverPerfectScore();
self.rewardNode = new RPALRewardNode( model.levelProperty.get() );
self.addChild( self.rewardNode );
}
So... I'll try changing the order in RPAL, and see if that fixes the problem.
User interface components (LevelCompletedNode and RewardNode) are now added to the scenegraph before initiating the "cheer" sound. See above commits to master.
@KatieWoe can you please re-test on the device that exhibits the problem?
Seems fixed in master
Thanks @KatieWoe. I'll proceed with patching the 1.2 branch.
1.2 branch has been patched. Labeling for regression testing in 1.2.0-rc.2.
Looks much better
Test device: iPad 2 Operating System: iOS 9.3.5 Browser: Safari 9 Problem description: For phetsims/QA/issues/162 When a level of the Game screen is beaten the sound effect of cheering will play a few seconds before the actual victory screen is shown. Steps to reproduce:
Screenshots: https://drive.google.com/file/d/1eWhVYMHk6unaqzWwaCpXTuitRhIwVbyO/view?usp=sharing