Exported from Notepad++
// Basic Snake // Snake Constants var SNAKE_WIDTH = 10; var SNAKE_HEIGHT = SNAKE_WIDTH; var SNAKE_DIM = SNAKE_WIDTH; var SNAKE_COLOR = Color.green; // Constants to represent the directions var EAST = 0; var SOUTH = 1; var WEST = 2; var NORTH = 3; var snake; var currentDirection = EAST; function start() { // TODO: create the snake and add it to the canvas setTimer(draw,50); keyDownMethod(keyDown); } function draw() { if (currentDirection == EAST) { snake.move(SNAKE_DIM,0); } // TODO: add the other three directions } function keyDown(e) { if (e.keyCode == Keyboard.LEFT) { currentDirection = WEST; } // TODO: add the other three directions }