Workshop › Tetris-style Blocks › Step 26 of 32
Every 10 lines is a new level, and points are multiplied by the level. The level is worked out from lines each time
we need it.
```js
function level() {
return Math.floor(lines / 10) + 1
}
score += POINTS[cleared] * level()
ctx.fillText('Level', panel, 300)
ctx.fillText(String(level()), panel, 322)
```lines / 10 rounded down with Math.floor, plus 1: 0–9 lines is level 1, 10–19 level 2, and so on.clearLines multiplies the points by the level (it uses level() before adding the new lines).Lines.level above function clearLines() {.clearLines, multiply the points by level().draw, under the lines number, write the two Level lines.Skills: Game states
← The side panel Faster every level →