diff --git a/src/screens/Game/Shapes/BaseShape.js b/src/screens/Game/Shapes/BaseShape.js index 82b72ab..0b891dd 100644 --- a/src/screens/Game/Shapes/BaseShape.js +++ b/src/screens/Game/Shapes/BaseShape.js @@ -53,8 +53,6 @@ export default class BaseShape { /** * Gets this object's current shape. - * - * Used by tests to read private fields */ getCurrentShape(): Shape { return this.#currentShape; diff --git a/src/screens/Game/logic/GameLogic.js b/src/screens/Game/logic/GameLogic.js index 4d62b6f..bf5c9e8 100644 --- a/src/screens/Game/logic/GameLogic.js +++ b/src/screens/Game/logic/GameLogic.js @@ -145,7 +145,7 @@ export default class GameLogic { callback(this.#gridManager.getCurrentGrid()); } this.#pressInInterval = setTimeout(() => - this.movePressedRepeat(false, callback, x, y), + this.movePressedRepeat(false, callback, x, y), isInitial ? this.#autoRepeatActivationDelay : this.#autoRepeatDelay ); } @@ -166,7 +166,8 @@ export default class GameLogic { getNextPiecesPreviews() { let finalArray = []; for (let i = 0; i < this.#nextPieces.length; i++) { - finalArray.push(this.#gridManager.getEmptyGrid(4, 4)); + const gridSize = this.#nextPieces[i].getCurrentShape().getCurrentShape()[0].length; + finalArray.push(this.#gridManager.getEmptyGrid(gridSize, gridSize)); this.#nextPieces[i].toGrid(finalArray[i], true); } diff --git a/src/screens/Game/logic/Piece.js b/src/screens/Game/logic/Piece.js index 2fbd084..34060ba 100644 --- a/src/screens/Game/logic/Piece.js +++ b/src/screens/Game/logic/Piece.js @@ -165,4 +165,8 @@ export default class Piece { getCoordinates(): Array { return this.#currentShape.getCellsCoordinates(true); } + + getCurrentShape() { + return this.#currentShape; + } }