Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: defeat music stops correctly during navigation. #1556

Merged
merged 3 commits into from
Mar 19, 2024

Conversation

d1vyanshu-kumar
Copy link
Contributor

The defeat music in the Tank Operation activity persists even after returning to a previous screen. This PR resolves the issue by ensuring that the defeat music stops correctly during navigation.
here is how I solve this issue:
by using the if statement i.e if the game ends && the screen is also changed then the sound will pause
Activity name: Tank-operation.
Issue: #1553
@llaske please review this PR.

@d1vyanshu-kumar
Copy link
Contributor Author

@llaske please review this PR.

@d1vyanshu-kumar
Copy link
Contributor Author

@llaske please review it now i think it looks good now.

@llaske
Copy link
Owner

llaske commented Mar 15, 2024

Why do you duplicate the same test condition?

image

@d1vyanshu-kumar
Copy link
Contributor Author

@llaske
if(this.endOfGame){ if(app.renderInto(document.getElementById("board"))){ sound.pause(); } }
I use duplicate condition because here we have to stop the sound when the user navigates to the home screen so I inside the if-statment, we have to add only sound.pause();
If is it not a good approach then I try another way. but it works i test in my local device it successfully solved the issue.
another way is to directly use sound.pause() inside the above statement but I think maybe it is not a good idea initially I think that for control sound I have to make a separate box so that it is more readable and further in future anyone can manipulate this if this is not a good approach then I use directly inside the previous if -statement if it is not appropriate.

Screenshot 2024-03-15 at 11 51 10 PM

@llaske
Copy link
Owner

llaske commented Mar 17, 2024

Not sure to understand your explanation.
Simpler is better: do not duplicate the if statement and add the pause call in the existing one.

@d1vyanshu-kumar
Copy link
Contributor Author

@llaske kindly review this now i think it looks good now.

@d1vyanshu-kumar
Copy link
Contributor Author

@llaske please review this pr.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants