Workshop › Sokoban › Step 11 of 29
The player
What we are doing
The last character: @ (or + on a goal) is the player, one { x, y } object, drawn as a blue square on top.
```js
let player
if (ch === '@' || ch === '+') player = { x, y }
tile(player.x, player.y, '#38bdf8', 10)
```
What it means
player holds the player's tile.
- It is drawn last, so it is painted on top of a goal it stands on.
Your turn
- Under
let boxes write let player.
- In
loadLevel, under the box if, write the player if.
- In
draw, under the box line, write the player line. Press Run.
Skills: Game states
← The boxes Two more levels →
All steps
- A level written as text
- The canvas and the pen
- The warehouse floor
- A function that draws
- A name for every tile
- Read the walls
- Draw the walls
- Center the level
- The goals
- The boxes
- The player
- Two more levels
- One step
- Walk with the arrows
- Boxes are in the way
- Push a box
- A box on a goal turns green
- Solved!
- On to the next level
- Which level?
- A line at the bottom
- Count the moves
- A photo of the game
- A photo before every move
- Undo
- Restart
- A record for every level
- Show the record
- Build it yourself: count the pushes