Skip to content

Commit

Permalink
fixed gameover function
Browse files Browse the repository at this point in the history
  • Loading branch information
ddevdan committed Mar 17, 2021
1 parent 957487a commit bc7df50
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ document.addEventListener('DOMContentLoaded', () => {
}


const keyPressed = { 37: moveLeft, 38: rotate, 39: moveRight, 40: "pressed 40" }
const keyPressed = { 37: moveLeft, 38: rotate, 39: moveRight, 40: moveDown }

function control(e) {
moveFunction = keyPressed[e.keyCode]
Expand Down Expand Up @@ -196,6 +196,18 @@ document.addEventListener('DOMContentLoaded', () => {
gameOverDisplay.innerHTML = "GAME OVER"
scoreDisplay.innerHTML = ""
clearInterval(timerId)
squares.forEach(square => {
if (square.classList.contains("none")) {
console.log("tem sim")
} else {
square.classList.remove('taken')
square.classList.remove('forma')
}



})

}

}
Expand Down

0 comments on commit bc7df50

Please sign in to comment.