Workshop › Sokoban › Step 21 of 29
The bottom strip shows a hint while playing, and a green message once the level is solved (a different one on the last level).
```js
ctx.textAlign = 'center'
ctx.font = '14px sans-serif'
if (solved()) {
const last = level === LEVELS.length - 1
ctx.fillStyle = '#4ade80'
ctx.fillText(last ? 'All levels solved!' : 'Solved! Press Space for the next level', canvas.width / 2, canvas.height - 16)
} else {
ctx.fillStyle = '#a8a29e'
ctx.fillText('Arrows: move', canvas.width / 2, canvas.height - 16)
}
```if ... else shows one of two lines: the green message when solved, the grey hint otherwise.last is true on the last level; last ? a : b picks the message.canvas.height - 16 is near the bottom, in the middle of the BOTTOM strip.In draw, under the Level line, leave an empty line and write the block. Press Run and solve the first level.
Skills: Game states
← Which level? Count the moves →