Remix Library / Games

Snake

The classic: eat the food, grow longer, don't bite yourself.

Beginner HTML · CSS · JavaScript
No account needed: you’ll start as a guest.
read-only · remix to edit
Preview

What you'll learn

  • Canvas drawing
  • Arrays
  • Keyboard events
  • Game loops
  • localStorage

Challenges

Remix it, then try these. Each one is a bit harder than the last.

  1. Change the colors of the snake and the food.
  2. Make the snake speed up a little every time it eats.
  3. Add a golden apple that appears sometimes and is worth 5 points.
  4. Let the snake wrap around to the other side instead of hitting the walls.
  5. Add walls or obstacles in the middle of the board.