MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / checkForGameOver

Function checkForGameOver

assets/js/Pacman.js:216–223  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

214
215 //check for a game over
216 function checkForGameOver() {
217 if (squares[pacmanCurrentIndex].classList.contains('ghost') &&
218 !squares[pacmanCurrentIndex].classList.contains('scared-ghost')) {
219 ghosts.forEach(ghost => clearInterval(ghost.timerId))
220 document.removeEventListener('keyup', movePacman)
221 setTimeout(function(){ alert("Game Over"); }, 500)
222 }
223 }
224
225 //check for a win - more is when this score is reached
226 function checkForWin() {

Callers 2

movePacmanFunction · 0.70
moveGhostFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected