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

Add Pause, Mute, and Full Screen Buttons #44

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add popup
TanishMoral11 committed Mar 16, 2024
commit a5298384369abfa527340e1a35e19a4984d3b186
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -58,7 +58,11 @@ function endGame() {
musicSound.pause();
inputDir = { x: 0, y: 0 };
updateMaxScore(score); // Update maximum score
alert("Game over. Press any key to play again");
if (score > maxScore) {
alert("Congratulations🎉! You have achieved a new high score! Press any key to play again");
} else {
alert("Game over. Press any key to play again");
}
score = 0; // Reset score
displayScores(); // Display scores
snakeArr = [{ x: 13, y: 15 }]; // Reset snake position