Using the snake_arrays example shown in class, create your very own snake game! This assignment will test your knowledge of everything we have done this far in the class. It is meant to be challenging but don't get discouraged. Stop and think about the problem before jumping right into the programming itself. Take small steps and ask questions. Don't be afraid to make mistakes!
Go back and look at how to do keyboard controls. Now instead of having the circles move around the screen following the mouse, have them move when you press the arrow keys (or WASD). Start off having the snake move when you are holding down the key and then change it so it can constantly move when you only tap the key.
Now that you have the snake moving with the arrow keys, make it end the game when the head of the snake runs off the screen. Take a look at the pong game we did in class to see how to check for an object hitting the edges of the screen.
This is the most tricky part. Instead of using all of the spots in the array, you will need to only partially fill the array. In other words, your array may have the ability to hold 50 spots, but you will only use 2. Each time you hit a piece of food, the snake needs to grow. This can be done by using a new spot in the array to save another coordinate. The shuffling part still is similar, just when you draw something, you will only draw the number of spots that the snake has.
Another tricky part. Make sure the game ends if the snake hits himself. Every time you move the head, check to see if part of the body is already on that spot. This would involve going through the for loop and checking with an if statement.
This is a zip file that Mr. Lamont has put together quickly, using the example file as a base, to create snake. Nothing fancy, but it works fairly well.