Workshop › Tetris-style Blocks › Step 24 of 32
Clearing lines scores points, and more lines at once score much more: 100, 300, 500 and 800 for 1 to 4. We also count the cleared lines.
```js
const POINTS = [0, 100, 300, 500, 800] // for clearing 0, 1, 2, 3 or 4 lines at once
let score
let lines
score = 0
lines = 0
score += POINTS[cleared]
lines += cleared
```POINTS[n] is the score for clearing n lines at once.newGame starts both counters at 0.clearLines adds the points and the number of lines after removing them.SHAPES write POINTS.let state write let score and let lines.newGame, under the board = ... line, set both to 0.clearLines, at the end, add the points and the lines.Skills: Game states, Arrays and objects
← Clear full rows The side panel →