Owen Cavender 201159294

Dependencies:   mbed Gamepad2

Revision:
16:9500059ad5d8
Parent:
14:7fb3c93343b6
--- a/snake.h	Sat May 30 03:06:22 2020 +0000
+++ b/snake.h	Sat May 30 05:43:50 2020 +0000
@@ -6,6 +6,9 @@
 #include "N5110.h"
 #include "Gamepad.h"
 
+/** Snake Class
+* Owen Cavender, University of Leeds
+*/
 
 class Snake
 {
@@ -13,55 +16,81 @@
 
 public:
     Snake();
+    /** constructor
+    */
     ~Snake();
+    /** deconstructor
+    */
 
-    enum Directions {
+    enum Directions {           /**enum of directions*/
         up,
         down,
         left,
         right,
-        null
+
     };
 
     void init();
-    void render_clear_tail(N5110 &lcd);
+    /** initialises 'Snake' class
+    */
     void get_direction(Gamepad &pad);
+    /** reads input from gamepad
+    *updates direction
+    */
+    void render_clear_tail(N5110 &lcd);
+    /** clears pixel on the end of snake
+    *before everything else on the screen is updated and rendered
+    */
     void move_snake();
+    /**alters the values assigned to the snake's body
+    *based on the _direction set in get_direction
+    */
     void apple_collected(N5110 &lcd, Gamepad &pad);
+    /** check to see if the apple x,y = snakehead x,y values
+    *increases score, triggers a true which causes generation of apple, updates counter
+    *Plays a tone and toggles LEDs
+    */
     void check_gameover(N5110 &lcd);
-    void render(N5110 &lcd);
-    // void print_display_time(N5110 &lcd);
+    /**checks if game is over based on 3 conditions
+    */
+    void get_Apple_position(N5110 &lcd);
+    /**sets the apple position
+    *an update of position is triggered by bool _reset_apple
+    */
+    void render(N5110 &lcd, Gamepad &pad);
+    /**draws the snake, border, and apple during the game
+    * if it is game over, it displays the score and a gameo over message
+    */
+
 
 
     Vector2D get_Snakehead();
-    int set_reset_value();
-    int get_reset_value();
-    bool get_timer_reset();
-    bool get_RST();
+    /**returns _x0, and _y0 values
+    */
+
     int get_countdown();
-
-    void gameover_true(N5110 &lcd, Gamepad &pad);
-    void get_Apple_position(N5110 &lcd);
+    /**reurns counter value
+    */
     int get_score();
+    /**returns score;
+    */
 
 private:
 
 
     bool get_gameover();
-
+    /** returns _gameover
+    *private as it is only used in Snake class
+    */
 
-
+    /**Snake private variables*/
+    Directions _direction;
     int _countdown;
     bool _gameover;
-    Directions _direction;
     int _score;
-//   float _display_time;
     int _reset_apple;
-    int _reset_value;
 
-
-
-    int _x0;
+    int _x0;            /**snake position variable*/
     int _y0;
     int _x1;
     int _y1;
@@ -79,18 +108,9 @@
     int _y7;
 
 
-
-
-    int _apx;
+    int _apx;       /**apple position variable*/
     int _apy;
 
-
-
-//Vector2D SK0;
-//Vector2D SK1;
-//Vector2D SK2;
-//Vector2D SK3;
-
 };