diff --git a/public/js/game.js b/public/js/game.js index 6683d9e..0eff152 100644 --- a/public/js/game.js +++ b/public/js/game.js @@ -226,7 +226,21 @@ class TetrisGame { } // Check for game over (piece locked above visible area) - if (this.currentPiece.y <= 0) { + // Only eliminate if any part of the piece is above y=0 (not visible) + let pieceAboveBoard = false; + for (let row = 0; row < this.currentPiece.shape.length; row++) { + for (let col = 0; col < this.currentPiece.shape[row].length; col++) { + if (this.currentPiece.shape[row][col]) { + const boardY = this.currentPiece.y + row; + if (boardY < 0) { + pieceAboveBoard = true; + break; + } + } + } + if (pieceAboveBoard) break; + } + if (pieceAboveBoard) { this.gameOver = true; this.eliminated = true; }