fix: hold piece now correctly uses next piece preview on first hold

This commit is contained in:
cmclark00 2025-03-30 18:15:07 -04:00
parent 03ff049bef
commit ce19427cca

View file

@ -97,8 +97,13 @@ class GameBoard(
if (holdPiece == null) {
// If no piece is held, hold current piece and spawn new one
holdPiece = current
currentPiece = nextPiece
spawnNextPiece()
spawnPiece()
// Reset position of new piece
currentPiece?.apply {
x = (width - getWidth()) / 2
y = 0
}
} else {
// Swap current piece with held piece
currentPiece = holdPiece