Dependencies:   mbed

Snake Game

Summary

Hello and welcome to my Snake Game. Snake is a simple game where you control a snake and eat an apple which increases your size. Normally touching the walls will kill you, always touching yourself will make you die!

Controls

The Controls for this game are simple the Start button starts the game (who would have thought) this button is the left button on the bottom of the gamepad next to the two blue potentiometers. The Reset button on the right of the potentiometers resets the game. Once the game starts use the left thumbstick to control the movement of the snake.

If you hit the wall with your snake you will die and the game will end.

Bugs/Missing Features

Unfortunatley I wasn't able to get the game eating the apple to work, when I tried I could never get it to detect the collisions I tried a few different ways but ran out of time. Because that doesn't work the score doesn't increase and the apple doesn't spawn in a different place. I will try continue to work on this when I have time as I enjoyed doing this project even though it was very frustrating at times!

Revision:
12:8eb40a18f15d
Parent:
11:ba20e1b516a1
Child:
13:c20acb3b1adf
--- a/Snake/Snake.cpp	Fri Jun 05 19:42:34 2020 +0000
+++ b/Snake/Snake.cpp	Fri Jun 05 20:47:43 2020 +0000
@@ -55,6 +55,13 @@
                         _move.x -=_speed; // Snake moves Left
                         } 
 
+
+/*  Deadly Wall turned on
+
+   //Uncomment this and comment the section in SnakeEngine.cpp if you want the snake to not die when he touches the edges as this will keep 
+   //him in safely in the game area 
+
+
     // Check that the Snakes coordinates aren't greater the the size of the screen which 
     // would mean the snake has gone off the screen
              if (_x>=(WIDTH-6)) { // 5 pixles for snake and 1 pixle for border
@@ -69,6 +76,10 @@
              if (_y<=9) {    // Checks that its in the game area as there is a line (8 pixels missing due to score and 1 pixle due to border) 
                   _y=9;
                     }
+      
+       // End of Save wall Section   */  
+          
+                 
 }
 
 void Snake::add_score()  // Not in use yet but will add to score when apple is ate by the snake