CS112 Final Project
Abigail Perry
Phase I
Project description:
I will create the game called "Snake" that is commonly found on cell phones
(or at least they used to be... now they have fancy smancy games!) using
MATLAB's GUIDE program. Rules:
A little more on how the snake moves: once you press up, down, left, or right, the direction of the snake changes. Each element of the snake (its body) changes direction when it gets to the point initially occupied by the snake's head.
Further, everytime the snake eats, its length increases, making it harder for the user to avoid running the snake into itself.
Coding for the game:
Phase I: My first goal is to get a snake of fixed length to move around the screen that listens to the command of the user (move up, down, left, right). Thus the snake only moves a single increment every time the user presses a button. Also I would like the random dots of fodo to appear on the screen that the snake can eat.
Phase II: The snake will increase in length every time it eats. Further, the snake will continue moving in the same direction until the user tells it otherwise (if this is possible to program).
Phase III: Keep track of scores. Every time the snake eats, the user gains points. Also create different levels. Harder the level, the faster the snake moves.
Functions:
Everytime the snake moves an increment, a "new" body part is created in the direction of motion of the snake, and the last element of the snake is removed. This is how the snake will move around the screen. Therefore I will need a vector that stores all points of the snake. In the initial phase when the snake does not change lengths, the number of points for the coordinates of the snake will remain constant. In the second phase, the vector will accommodate the increase in the snake length.
The snake will consist of blocks of squares "tied" together. This way it does not take as long for the snake's images to be created for each rame (it would take more points, and therefore more time to create a snake made up of little starts, for example).
What my GUI display might look like: