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) {