Snake

Use the arrow keys to move the snake around to eat food! Be careful, if you eat your tail, the game ends.


Play this demo in full screen.

1) Create a "head" to control. Make the head move at a constant rate, and make it turn left and right when the left and right arrow keys are pressed.


Play this demo in full screen.

2) Create "food" for your snake to eat. Have the food be created at a constant rate and appear at random points on the screen.


Play this demo in full screen.

3) Create a scoreboard. Whenever the snake touches a food sprite, have the food sprite disappear, and make the score increase.


Play this demo in full screen.

4) Make it so that each time the snake eats food, the snake's tail grows longer. Have the snake's tail trail behind the snake.


Play this demo in full screen.

5) Create obstacles for your snake to avoid.


Play this demo in full screen.

6) Have the game stop if the snake touches its tail, or if it touches any of the obstacles.


Play this demo in full screen.

7) When the game stops, display to the player that the game is over.


Play this demo in full screen.

8) Make it so that when the game ends, if you press a button ("R" is used in the demo), the game resets (position, score, and tail).


Play this demo in full screen.

9) At the start of the game, display how to play the game to the player. Have the game start by pressing a button ("Space" is used in the demo), and have the displayed information stop when the game starts.


Play this demo in full screen.

Challenge: Make a "difficulty counter." Make it so that if the difficulty increases, the snake moves faster, and if the difficulty decreases, the snake moves slower. Display the difficulty to the player (you may have to adjust the way the snake's tail follows the head to make it work). In the demo, the difficulty is changed when you hit the up or down arrow.


Play this demo in full screen.