Skip to content

Commit

Permalink
Fixed reset game bug around pellet numbers not being reset when the g…
Browse files Browse the repository at this point in the history
…ame is restarted by the player, by adding a resetPellets function to the callstack initiated by the reset game function.
  • Loading branch information
milochambers96 committed Aug 22, 2024
1 parent 516b1d3 commit 4465b1c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -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">
<script src="./scripts/app.js"></script>
<title>PacMan-Clone</title>
<title>DotMan: A PacMan Adventure</title>
</head>

<body>
Expand Down
5 changes: 5 additions & 0 deletions scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -587,6 +587,7 @@ function init() {
cells.length = 0;
createGrid();
resetPositions();
resetPellets();
}

function resetPositions() {
Expand All @@ -597,6 +598,10 @@ function init() {
chaserGhost.displayGhost();
ambusherGhost.displayGhost();
}

function resetPellets() {
pellets = arrayOfPellets.length
}
}

window.addEventListener("DOMContentLoaded", init);
Expand Down

0 comments on commit 4465b1c

Please sign in to comment.