Skip to content

Commit a9b692e

Browse files
Fixed the bug that caused the game to generate the astroids rapidly everytime play again button was clicked.
1 parent ba34b8b commit a9b692e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

script.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ document.addEventListener("DOMContentLoaded", function() {
3030
quitBtn.addEventListener("click", quitGame);
3131

3232
function startGame() {
33+
clearInterval(gameInterval);
3334
resetGame();
3435
interfaceDiv.style.display = "none";
3536
gameContainer.style.display = "block";
@@ -40,7 +41,6 @@ document.addEventListener("DOMContentLoaded", function() {
4041
}
4142

4243
function endGame() {
43-
clearInterval(gameInterval);
4444
gameContainer.style.display = "none";
4545
finalScore.textContent = score;
4646
endScreen.classList.remove("hidden");

0 commit comments

Comments
 (0)