From a89a60691c6154530b56f73ba28b04ae4d93d830 Mon Sep 17 00:00:00 2001 From: adrien Date: Thu, 7 Dec 2023 20:02:43 +0100 Subject: [PATCH] no wall nound on hard drop --- js/app.js | 8 ++++---- js/game_logic.js | 4 +--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/js/app.js b/js/app.js index 7a8ed92..b109eea 100644 --- a/js/app.js +++ b/js/app.js @@ -119,9 +119,9 @@ let playerActions = { hardDrop: function() { scheduler.clearTimeout(lockDown) playSound(hardDropSound) - while (matrix.piece.move(TRANSLATION.DOWN, ROTATION.NONE, true)) stats.score +=2 + while (matrix.piece.move(TRANSLATION.DOWN, ROTATION.NONE, true)) stats.score += 2 matrix.table.classList.add("hard-dropped-table-animation") - lockDown() + lockDown(true) return true }, @@ -215,10 +215,10 @@ function fall() { matrix.piece.move(TRANSLATION.DOWN) } -function lockDown() { +function lockDown(hardDropped=false) { scheduler.clearTimeout(lockDown) scheduler.clearInterval(fall) - if (lastActionSucceded) wallSound.play() + if (lastActionSucceded && !hardDropped) playSound(wallSound) if (matrix.lock()) { let tSpin = matrix.piece.tSpin diff --git a/js/game_logic.js b/js/game_logic.js index 8cdd978..11b6f57 100644 --- a/js/game_logic.js +++ b/js/game_logic.js @@ -349,13 +349,11 @@ class Tetromino { } matrix.drawPiece() return true - } else if (!hardDropped) { - if (translation == TRANSLATION.DOWN) { + } else if (!hardDropped && translation == TRANSLATION.DOWN) { this.locked = true if (!scheduler.timeoutTasks.has(lockDown)) scheduler.setTimeout(lockDown, stats.lockDelay) matrix.drawPiece() - } } }