Javascript Snake Game

Today, we're going to recreate the classic game snake in the Javascript programming language.

Download the tutorial

Before you can start the tutorial, you'll need to download the tutorial to your computer to edit the source code.

Launch your programming environment

When programming, you'll generally want these tools on hand:

  • Your browser to see the code running (I recommend Chrome)
  • A text editor to change the code (I recommend Sublime)
  • A javascript console so you can experiment and print out debugging messages. This is built into your browser.

Once you have these tools available, we need to open the files we'll be working with:

  • Open game/snake.js in your text editor
  • Open game/index.html in your browser
  • Open your browser's javascript console
  • type alert("hello world"); in your browser's javascript console and dismiss the window that pops up

Stop and reflect

  • The javascript console is one of the fastest ways to get feedback on whether the code does what you expect. How else can you get feedback about whether your code does what you expect?
  • Why shouldn't you use Word or Google Docs to edit code?

Helpful Links

Next Step: