From bdeb6c8849141aac7dd99d08cdc4b3a7d0ca3089 Mon Sep 17 00:00:00 2001 From: Josue Zamudio Date: Sat, 21 Mar 2026 01:07:21 +0000 Subject: [PATCH] Fix garbage elimination bug and align board with header - Change y-- instead of y++ when pushing piece up on garbage - Add y < 0 check to properly detect piece pushed off top - Remove margin-top from battle grid to align with header Co-Authored-By: Claude Opus 4.6 --- public/css/style.css | 1 - server/index.js | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/public/css/style.css b/public/css/style.css index 742919b..39aa6ef 100644 --- a/public/css/style.css +++ b/public/css/style.css @@ -197,7 +197,6 @@ button:active { display: flex; justify-content: center; align-items: center; - margin-top: 20px; } /* Main player board - centered and large */ diff --git a/server/index.js b/server/index.js index 5a1d89a..7ca8a77 100644 --- a/server/index.js +++ b/server/index.js @@ -396,11 +396,11 @@ function addGarbageToPlayer(player) { garbageRow[Math.floor(Math.random() * BOARD_WIDTH)] = 0; player.board.push(garbageRow); - // Push current piece up by 1 row if it exists + // Push current piece up by 1 row if it exists (y decreases when moving up) if (player.currentPiece) { - player.currentPiece.y++; - // Eliminate if the piece is pushed above the board - if (!isValidPosition(player.currentPiece, player.currentPiece.x, player.currentPiece.y, player.board)) { + player.currentPiece.y--; + // Eliminate if the piece is pushed above the board or collides + if (player.currentPiece.y < 0 || !isValidPosition(player.currentPiece, player.currentPiece.x, player.currentPiece.y, player.board)) { player.eliminated = true; } }