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:
@@ -197,7 +197,6 @@ button:active {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
/* Main player board - centered and large */
|
||||
|
||||
+4
-4
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user