From e25f31122711b953598ab1b95f4848322f345cc2 Mon Sep 17 00:00:00 2001 From: Mark Bellingham Date: Fri, 29 May 2020 09:23:26 +0100 Subject: [PATCH] Falling tetrominoes on multi-line score Fixes the bug where a tetromino would appear elongated when you score more than one line at a time --- js/app.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/app.js b/js/app.js index c4d6503..1036198 100644 --- a/js/app.js +++ b/js/app.js @@ -244,6 +244,7 @@ document.addEventListener('DOMContentLoaded', () => { lines += 1 scoreDisplay.innerHTML = score linesDisplay.innerHTML = lines + undraw() row.forEach(index => { squares[index].style.backgroundImage = 'none' squares[index].classList.remove('block2') || squares[index].classList.remove('block') @@ -253,6 +254,7 @@ document.addEventListener('DOMContentLoaded', () => { const squaresRemoved = squares.splice(currentIndex, width) squares = squaresRemoved.concat(squares) squares.forEach(cell => grid.appendChild(cell)) + draw() } } } @@ -265,4 +267,4 @@ document.addEventListener('DOMContentLoaded', () => { menu.style.display = 'none' }) -}) \ No newline at end of file +})