-
Print to the console the width and height of the canvas.
-
Draw a square to the center of the canvas.
-
Draw a square to the corner of the canvas.
-
Print to the console both square coordinate.
-
Check the square coordinates. Are these points partible of the SIZE of the square edges.
-
Create a square drawing function that takes 1 parameter: the square size and draws a square of that size to the center of the canvas.
-
Create a loop that draws 20 squares with the previous function.
-
Create a function that update the square coordinate each time when its invited.
-
Move the square from the upper left corner to the upper right corner. Use setinterval.
-
Create a snake object/function, that store the current position of the snake and the direction.
-
Create a function that draw the snake current position.
-
Create a function that update the snake current position based on direction.
-
Create a board object, which have a Snake object.
-
Create a function, which draw the snake.
- Invite board draw to the window.
-
Snake. Create a function that set the snake direction based on keyboardkeys.
-
Board. Create a function which reset the snake current position if reach the border.
-
Board. Create random square to the canvas as food.
-
Snake. Store body in snake. Add one more x y coordnate if food coordinate and snake coordinate is equal. The body has to be updated with the snake head.
-
Reset the body and the initial coordinate if snake eats itself.