From 4465b1ca0e53a91aee354b3171ae80023e610b7d Mon Sep 17 00:00:00 2001 From: Milo Chambers Date: Thu, 22 Aug 2024 09:00:34 +0100 Subject: [PATCH] Fixed reset game bug around pellet numbers not being reset when the game is restarted by the player, by adding a resetPellets function to the callstack initiated by the reset game function. --- index.html | 2 +- scripts/app.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 178dacd..d8e2822 100644 --- a/index.html +++ b/index.html @@ -11,7 +11,7 @@ href="https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Russo+One&family=Audiowide&family=Bangers&family=Lato:wght@100;300;400;700;900&family=Luckiest+Guy&family=Poppins:wght@100;400;700&display=swap" rel="stylesheet"> - PacMan-Clone + DotMan: A PacMan Adventure diff --git a/scripts/app.js b/scripts/app.js index de68f39..42ae8ca 100644 --- a/scripts/app.js +++ b/scripts/app.js @@ -587,6 +587,7 @@ function init() { cells.length = 0; createGrid(); resetPositions(); + resetPellets(); } function resetPositions() { @@ -597,6 +598,10 @@ function init() { chaserGhost.displayGhost(); ambusherGhost.displayGhost(); } + + function resetPellets() { + pellets = arrayOfPellets.length + } } window.addEventListener("DOMContentLoaded", init);