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 <noreply@anthropic.com>
This commit is contained in:
2026-03-21 01:07:21 +00:00
parent 27b0adcc90
commit bdeb6c8849
2 changed files with 4 additions and 5 deletions
+4 -4
View File
@@ -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;
}
}