The game starts with a 2-dot snake and the player can control the snake by an analog joystick. The snake grows by one dot after eating the food and the player's score is incremented by one. A buzzer sounds after the snake eats the food and the speed of the snake also increases. The game continues until the snake eats itself after which the game is over and the player's score and the game highscore is shown. Also the game highscore is retrieved from EEPROM and updated if the the highscore is beaten.
Protocols/Services used in the project:
- SPI for LED Matrix interfacing.
- ADC for Joystick module interfacing
- GPIO for Buzzer
- EEPROM for Game HighScore
- Initialise Snake with two dots. The snake is represented by a 50x2 matrix with each dot represented by the position on the matrix(x,y)
- The ADC is called and the direction is taken and the snake is moved one dot accordingly.
- If the snake head touches the food pixel, then the snake is grown and a food pixel is drawn randomly on the screen and the loop continues.
- If the snake head touches itself, then the loop breaks and the player's score and highscore is displayed on the screen. The game variables are reset and the loop continues.
GAME VIDEO LINK