Summary: When I clicked the mute button at the main page, the music is successfully muted. Nevertheless, when I then clicked the game button, say "IELTS" button and then redirect to the playing scene, The music is continuously changed between on and off and the button is continuously changed between muted and unmuted. Steps to reproduce: 1. entering the game and in the login scene, click the mute button. 2. Click the "IELTS" button to redirect to the playing scene. 3. In the playing scene, you will find the problem described above. Expected result: It is expected after clicking the mute button and before clicking unmute, the figure of the button will not change and the music should not play. Actual result: After clicking the mute button and before clicking unmute, the figure of the button continuously changed between on and off and the button is continuously changed between muted and unmuted. Suspected bug: Sorry, I am not familiar with how you code this part.
(In reply to ruixinli7-c from comment #0) > Summary: > > When I clicked the mute button at the main page, the music is successfully > muted. Nevertheless, when I then clicked the game button, say "IELTS" button > and then redirect to the playing scene, The music is continuously changed > between on and off and the button is continuously changed between muted and > unmuted. > > Steps to reproduce: > > 1. entering the game and in the login scene, click the mute button. > 2. Click the "IELTS" button to redirect to the playing scene. > 3. In the playing scene, you will find the problem described above. > > Expected result: > > It is expected after clicking the mute button and before clicking unmute, > the figure of the button will not change and the music should not play. > > Actual result: > > After clicking the mute button and before clicking unmute, the figure of the > button continuously changed between on and off and the button is > continuously changed between muted and unmuted. > > Suspected bug: > > Sorry, I am not familiar with how you code this part. Hi, Ruixin! Thanks for the reporting. Actually it is a very serious bug which significantly decrease the user experience. The problem is explained below: In the music controller class, there is following code: @Override public void update() { for(int i=0; i<GlobalConstants.NUM_GAME_MODE; i++) { startButtons[i].handleEvent(mouse.mousePos); startButtons[i].update(); } handleEvent(mouse); timeElapsed += timer.DeltaTime(); if(timeElapsed >= 300) { sequenceIndex++; sequenceIndex %= 98; timeElapsed -= 300; } MusicController.getInstance().handleClickEvent(mouse.mousePos); mouse.isClicked = false; } Nevertheless, you set mouse.isClicked = false at the end. This will cause trouble when you finish update the music controller. As in the same scene, there are other class. I fix this bug by doing the following with some code refactoring: create: private void handleMouseClick(Mouse mouse) { if(mouse.isClicked) { MusicController.getInstance().handleClickEvent(mouse.mousePos); for(int i=0; i<GlobalConstants.NUM_GAME_MODE; i++) { startButtons[i].handleEvent(mouse.mousePos); startButtons[i].update(); } mouse.isClicked = false; } } and substitute mouse.clicked by this.