From d4f353394ff0966239e154fec0ec64edc89c2224 Mon Sep 17 00:00:00 2001 From: enzotar Date: Fri, 27 Feb 2026 12:44:19 -0800 Subject: [PATCH] =?UTF-8?q?fix:=20keyboard=20inputs=20now=20respect=20coll?= =?UTF-8?q?ision=20=E2=80=94=20soft=20drop=20and=20hard=20drop=20gated=20o?= =?UTF-8?q?n=20blocked?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ArrowDown soft drop, Space hard drop, and Drop button all bypassed the blocked signal, letting pieces pass through frozen blocks. Now all three gate on blocked before modifying py. --- examples/game-tetris.ds | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/game-tetris.ds b/examples/game-tetris.ds index a3bfbdf..6b460d9 100644 --- a/examples/game-tetris.ds +++ b/examples/game-tetris.ds @@ -76,8 +76,8 @@ let lockTick = 0 on keydown(ev) -> px = if gameOver then px else (if paused then px else (if ev.key == "ArrowLeft" then (if px > 0 then px - 1 else px) else px)) on keydown(ev) -> px = if gameOver then px else (if paused then px else (if ev.key == "ArrowRight" then (if px < 7 then px + 1 else px) else px)) on keydown(ev) -> rotation = if gameOver then rotation else (if paused then rotation else (if ev.key == "ArrowUp" then (rotation + 1) % 4 else rotation)) -on keydown(ev) -> py = if gameOver then py else (if paused then py else (if ev.key == "ArrowDown" then (if py < 18 then py + 1 else py) else py)) -on keydown(ev) -> py = if gameOver then py else (if paused then py else (if ev.key == " " then 18 else py)) +on keydown(ev) -> py = if gameOver then py else (if paused then py else (if blocked then py else (if ev.key == "ArrowDown" then (if py < 18 then py + 1 else py) else py))) +on keydown(ev) -> py = if gameOver then py else (if paused then py else (if blocked then py else (if ev.key == " " then 18 else py))) on keydown(ev) -> paused = if ev.key == "p" then (if paused then 0 else 1) else paused -- ================================================================ @@ -313,7 +313,7 @@ view tetris_game = column [ } button "Left" { click: px = if px > 0 then px - 1 else px, variant: "secondary" } button "Right" { click: px = if px < 7 then px + 1 else px, variant: "secondary" } - button "Drop" { click: py = 18, variant: "secondary" } + button "Drop" { click: py = if blocked then py else 18, variant: "secondary" } button "Rotate" { click: rotation = (rotation + 1) % 4, variant: "secondary" } button "Reset" { click: score = 0; lines = 0; level = 1; gameOver = 0; paused = 0; piece = 6; nextPiece = 1; px = 3; py = 0; rotation = 0; g16 = [0,0,0,0,0,0,0,0,0,0]; g17 = [0,0,0,0,0,0,0,0,0,0]; g18 = [0,0,0,0,0,0,0,0,0,0]; g19 = [0,0,0,0,0,0,0,0,0,0],