Snake vs Block Game to be run upon K64F.

Dependencies:   mbed

Revision:
94:4e603bd6c381
Parent:
83:329da564799a
Child:
95:b068b0735f45
--- a/GameObjects/Barriers/Barriers.h	Wed May 08 23:08:49 2019 +0000
+++ b/GameObjects/Barriers/Barriers.h	Wed May 08 23:36:12 2019 +0000
@@ -5,52 +5,60 @@
 #include "N5110.h"
 #include "Gamepad.h"
 
-
+/** Barriers Class
+@brief This class helps to draw barriers in the game which are obstacles the snake has no effect to but stops it's x axis motion.
+@author Ahmed N.Adamjee
+@date 9th May 2019
+*/
 class Barriers
 {
-    public:
+public:
+    /** Constructor */
     Barriers();
+    /** Destructor */
     ~Barriers();
-    /** Initialise Barriers
-    *
-    *   This function initialises the Barriers library.
+    
+    /** 
+    * @brief Initialises barrier position and reset variable and gets pointers of lcd from int main() to be used privately in the entire class.
+    * @param N5110 *lcd @details pointer to the N5110 object in main, address of this pointer is saved to make availability to the entire class, without passing address to each function.
     */
     void init(N5110 *lcd);
-    
-    /** Draw
-    *
-    *   This function draws the Barriers onto the screen.
+
+    /**
+    * @brief This function draws the Barriers onto the screen.
+    * @param block_y_pos @details This is the y axis position of the blocks sprites.
     */
-    void draw(int b_y);
-    
-    /** Update
-    *
-    *   This function updates the position of the Barriers as they move down the screen.
+    void draw(int block_y_pos);
+
+    /**
+    * @brief This function updates the position of the Barriers as they move down the screen.
+    * @param blockgap @details this is the amount in pixels of the gap between blocks
     */
     void update(int blockgap);
-    
-    /** Get Position
-    *
-    *   This function obtains the coordinates of the top-left pixel in the Barriers sprites.
+
+    /**
+    * @brief This function obtains the coordinates of the top-left pixel in the Barriers sprites.
+    * @returns Vector2D barrierpos @details this is a struct that saves the x and y psition of the origin of the barriers sprite to be read.
     */
+
     Vector2D get_pos();
-    
-    /** Set Position
-    *
-    *   This function is used to change the position of the barrier to specific coordinates when called.
+
+    /**
+    * @brief This function is used to change the position of the barrier to specific coordinates when called.
+    * @param Vector2D p @details this is a struct that saves the x and y psition of the origin of the barriers sprite to be set.
     */
     void set_pos(Vector2D p);
-    
-    
-    Vector2D velocity;
-    
-    private:
-    int reset;
+
+
+    Vector2D velocity; //This is a struct that stores the x and y axis velocities of the barrier.
+
+private:
+    int reset; //reset is used to draw a new set of barriers.
     int _barx;  //barrier x
     int _bary;  //barrier y
-    int _barriergap;
-    int _blockgap;
-    
+    int _barriergap; //gap between barriers falling
+    int _blockgap; //gap between blocks falling.
+
     //Pointer to the game pad object pad.
     Gamepad *_pad;
     //Pointer to the N5110 object lcd.