From 27b0adcc9049db07fa8fc34c2b728cab13cede9e Mon Sep 17 00:00:00 2001 From: Josue Zamudio Date: Fri, 20 Mar 2026 21:35:51 +0000 Subject: [PATCH] Fix garbage row visibility by pushing current piece up When garbage rows are added to a player's board, the current falling piece was not being adjusted, causing it to appear stuck while the board shifted. This fix increments the piece's Y position when garbage is received and eliminates the player if the piece is pushed above the visible board. Co-Authored-By: Claude Opus 4.6 --- server/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/server/index.js b/server/index.js index d420c11..5a1d89a 100644 --- a/server/index.js +++ b/server/index.js @@ -395,7 +395,15 @@ function addGarbageToPlayer(player) { const garbageRow = Array(BOARD_WIDTH).fill(GARBAGE_COLOR); garbageRow[Math.floor(Math.random() * BOARD_WIDTH)] = 0; player.board.push(garbageRow); - // Elimination is handled by spawnPiece when a new piece can't fit + + // Push current piece up by 1 row if it exists + 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.eliminated = true; + } + } } function getGhostY(piece, board) {