Project for Israeli Techub - The Snake Game
Game description
In this game the player controls a square on a bordered plane. As it moves forward, it leaves a trail behind, resembling a moving snake. The snake has a specific length, so there is a moving tail a fixed number of units away from the head. The player loses when the snake runs into the screen border, a trail or itself.
The snake can eat apples by running into them with its head. Each apple eaten makes the snake longer, so controlling it is progressively more difficult. After an apple is eaten, another one is created at some random point on the board.
In addition, you should let the player choose one of three game levels: Novice, Intermediate and Hard. The level of the game determines the speed in which the snake moves.
At the end of the game show the player its total score (each apple eaten = 10 points). Save the highest score achieved so far in local storage.
Use OO principles in writing your code. Separate the game UI from its logic. Develop each part of the game in a separate class.
All settings of the game should be configurable, such as: board size, number of simultaneous apples on the screen, initial length of the snake, the snake’s speed for each game level, etc. Use local storage to store these settings, and let the user change them via a menu.