placeEater()and start by making it highlight potential Tiles
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
You should call a function named
reset if the cakeEater exists and the player presses 'r'
registerto check if 'r' is pressed
82which you could get with
tilesto an empty array
var levelNum = 0;
If levelNum is 0, this will create
If levelNum is 1, this will create