fix line clear !?
This commit is contained in:
parent
44684fe459
commit
063ccba7d7
12
app.js
12
app.js
@ -798,16 +798,18 @@ function lockDown() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Cleared lines
|
// Cleared lines
|
||||||
let clearedLines = Array.from(new Set(blocksPosition.map(minoPosition => minoPosition.y)))
|
let nbClearedLines = 0
|
||||||
.filter(y => matrix.blocks[y].filter(lockedMino => lockedMino).length == matrix.columns)
|
for (let y=0; y<matrix.rows; y++) {
|
||||||
.sort()
|
let row = matrix.blocks[y]
|
||||||
for (y of clearedLines) {
|
if (row.filter(lockedMino => lockedMino).length == matrix.columns) {
|
||||||
matrix.blocks.splice(y, 1)
|
matrix.blocks.splice(y, 1)
|
||||||
matrix.blocks.unshift(Array(matrix.columns))
|
matrix.blocks.unshift(Array(matrix.columns))
|
||||||
matrix.table.rows[y].classList.add("cleared-line-animation")
|
matrix.table.rows[y].classList.add("cleared-line-animation")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
matrix.redraw()
|
matrix.redraw()
|
||||||
stats.lockDown(clearedLines.length, tSpin)
|
stats.lockDown(nbClearedLines, tSpin)
|
||||||
|
|
||||||
generate()
|
generate()
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user