Snake project
Instructions
1. Create canvas
<canvas id="canvas" width="400" height="400"></canvas>2. Check created correctly. Explain variables. Case is important
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
const width = 400;
const height = 400;
// other way of declaring variable is let. will explain later
ctx.fillStyle = "white";
ctx.fillRect(0, 0, width, height);
ctx.strokeStyle = "black";
ctx.strokeRect(0, 0, width, height);3. Function
4. Paint a cell. Demo in Paint what will do

4.5 Checkpoint
5. Create a snake

6. Draw snake
7. Lets make the snake move

8. Lets make the snake move in different directions
9. Lets End the game if you hit a boundary
10. Lets add food
Last updated