fix line clear
This commit is contained in:
parent
10b4297012
commit
c0acba71bc
5
app.js
5
app.js
@ -701,7 +701,7 @@ function lockDown() {
|
|||||||
|
|
||||||
lockedMinoesCoord = matrix.piece.minoesCoord[matrix.piece.orientation]
|
lockedMinoesCoord = matrix.piece.minoesCoord[matrix.piece.orientation]
|
||||||
.translate(matrix.piece.center)
|
.translate(matrix.piece.center)
|
||||||
if (lockedMinoesCoord.every(minoCoord => minoCoord.y >= 4)) {
|
if (lockedMinoesCoord.some(minoCoord => minoCoord.y >= 4)) {
|
||||||
lockedMinoesCoord.forEach(minoCoord => {
|
lockedMinoesCoord.forEach(minoCoord => {
|
||||||
matrix.lockedMinoes[minoCoord.y][minoCoord.x] = matrix.piece.className
|
matrix.lockedMinoes[minoCoord.y][minoCoord.x] = matrix.piece.className
|
||||||
matrix.drawMino(minoCoord, matrix.piece.className)
|
matrix.drawMino(minoCoord, matrix.piece.className)
|
||||||
@ -713,7 +713,6 @@ function lockDown() {
|
|||||||
let [a, b, c, d] = matrix.piece.tSlots[matrix.piece.orientation]
|
let [a, b, c, d] = matrix.piece.tSlots[matrix.piece.orientation]
|
||||||
.translate(matrix.piece.center)
|
.translate(matrix.piece.center)
|
||||||
.map(minoCoord => !matrix.cellIsEmpty(minoCoord))
|
.map(minoCoord => !matrix.cellIsEmpty(minoCoord))
|
||||||
.sort()
|
|
||||||
if (a && b && (c || d))
|
if (a && b && (c || d))
|
||||||
tSpin = T_SPIN.T_SPIN
|
tSpin = T_SPIN.T_SPIN
|
||||||
else if (c && d && (a || b))
|
else if (c && d && (a || b))
|
||||||
@ -723,6 +722,7 @@ function lockDown() {
|
|||||||
// Cleared lines
|
// Cleared lines
|
||||||
let clearedLines = Array.from(new Set(lockedMinoesCoord.map(minoCoord => minoCoord.y)))
|
let clearedLines = Array.from(new Set(lockedMinoesCoord.map(minoCoord => minoCoord.y)))
|
||||||
.filter(y => matrix.lockedMinoes[y].filter(lockedMino => lockedMino).length == matrix.columns)
|
.filter(y => matrix.lockedMinoes[y].filter(lockedMino => lockedMino).length == matrix.columns)
|
||||||
|
.sort()
|
||||||
for (y of clearedLines) {
|
for (y of clearedLines) {
|
||||||
matrix.lockedMinoes.splice(y, 1)
|
matrix.lockedMinoes.splice(y, 1)
|
||||||
matrix.lockedMinoes.unshift(Array(matrix.columns))
|
matrix.lockedMinoes.unshift(Array(matrix.columns))
|
||||||
@ -738,7 +738,6 @@ function lockDown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function gameOver() {
|
function gameOver() {
|
||||||
console.log("GAME OVER")
|
|
||||||
matrix.piece.locked = false
|
matrix.piece.locked = false
|
||||||
matrix.drawPiece()
|
matrix.drawPiece()
|
||||||
document.onkeydown = null
|
document.onkeydown = null
|
||||||
|
@ -130,13 +130,13 @@ span {
|
|||||||
opacity: 1;
|
opacity: 1;
|
||||||
transform: scale3d(1, 1, 1);
|
transform: scale3d(1, 1, 1);
|
||||||
}
|
}
|
||||||
90% {
|
85% {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transform: scale3d(1, 1, 1);
|
transform: scale3d(1, 1, 1);
|
||||||
}
|
}
|
||||||
to {
|
to {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transform: scale3d(1.5, 1, 1);
|
transform: scale3d(1.5, 0, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -150,13 +150,13 @@ span {
|
|||||||
transform:translateZ(0);
|
transform:translateZ(0);
|
||||||
transform: scale3d(1, 1, 1);
|
transform: scale3d(1, 1, 1);
|
||||||
}
|
}
|
||||||
90% {
|
85% {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transform: scale3d(1, 1, 1);
|
transform: scale3d(1, 1, 1);
|
||||||
}
|
}
|
||||||
to {
|
to {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transform: scale3d(1.5, 1, 1);
|
transform: scale3d(1.5, 0, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user