add drawHologram function to display the current piece's shadow on the board
This commit is contained in:
parent
f70c427095
commit
4a8299e5a6
@ -91,6 +91,20 @@ function refreshBoard() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
drawCurrentPiece();
|
drawCurrentPiece();
|
||||||
|
drawHologram();
|
||||||
|
}
|
||||||
|
|
||||||
|
function drawHologram() {
|
||||||
|
let pieceBis = clonePiece(game.currentPiece);
|
||||||
|
|
||||||
|
while (ifMoveDown(pieceBis, game)) {
|
||||||
|
moveDown(pieceBis);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 0; i < pieceBis.squares.length; i++) {
|
||||||
|
let square = pieceBis.squares[i];
|
||||||
|
drawSquare(square.x, square.y, square, 0.5);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function displayPreview(game) {
|
function displayPreview(game) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user