From 0fb90dbbacac12debdd3e2646c6d40b812dd7c69 Mon Sep 17 00:00:00 2001 From: Reinhard Schu Date: Mon, 29 Jan 2024 20:08:11 +0000 Subject: [PATCH] Update app.js In the freeze() function, call addScore() first, before starting a new tetromino falling. This is to eliminate rogue stuck squares after clearing completed lines. --- app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.js b/app.js index c1bfb48..12dd0e4 100644 --- a/app.js +++ b/app.js @@ -105,6 +105,7 @@ document.addEventListener('DOMContentLoaded', () => { function freeze() { if(current.some(index => squares[currentPosition + index + width].classList.contains('taken'))) { current.forEach(index => squares[currentPosition + index].classList.add('taken')) + addScore() //start a new tetromino falling random = nextRandom nextRandom = Math.floor(Math.random() * theTetrominoes.length) @@ -112,7 +113,6 @@ document.addEventListener('DOMContentLoaded', () => { currentPosition = 4 draw() displayShape() - addScore() gameOver() } }