Planning

Step 7
`placeEater()`

and start by making it highlight potential TilesCheck Your Work

Step 10
Step 11

**Here is a quick explanation if you are curious where this comes from:**

`mouseX % tilesize`

returns the remainder of `mouseX / tilesize`

.

So for example if mouseX is at 54, we would want to set `x`

to 50.

`mouseX % tilesize`

is equal to 4 because:

54 % 50 = 4

So then is

```
mouseX - mouseX % tilesize
= 54 - (54 % 4)
= 54 - 4
= 50
```

Check Your Work

Step 12
Challenge

Step 15
Check Your Work

Step 16
Planning

Step 17
Challenge

Step 23
You should call a function named `reset`

if the cakeEater exists and the player presses 'r'

- Use
`register`

to check if 'r' is pressed - the keyCode for 'r' is
`82`

which you could get with`'r'.charCodeAt(0)`

- set
`tiles`

to an empty array - set cakeEater to null
- uses Tile.createGrid to restart the level

Step 32

var levelNum = 0;

Step 33

Tile.createGrid(levels[levelNum]);

If levelNum is 0, this will create `level 0`

If levelNum is 1, this will create `level 1`

Planning

Step 36
Step 38

Check Your Work

Step 41
CakeEater 6: Multiple Levels Info

For Teachers and Schools

Teach coding to your students with MVCode Teach

MVCode offers an integrated product designed to teach coding to students.