ELEC2645 (2018/19) / Mbed 2 deprecated el17szs

Dependencies:   mbed

Revision:
28:d0b0a64a832d
Parent:
26:6427f09cf8d3
Child:
30:43aace0fdbdf
--- a/Ball/Ball.h	Wed May 01 23:01:44 2019 +0000
+++ b/Ball/Ball.h	Tue May 07 17:50:58 2019 +0000
@@ -16,19 +16,59 @@
 public:
     Ball();
     ~Ball();
+     /** 
+    * @brief Initlialises the Bat class
+    * @details Sets the Ball's starting co-ordinates and sets the class variables to 0
+    */
     void init(int size,int speed);
+    /** 
+    * @brief Draws the ball onto the screen
+    * @details The ball is drawn based on the current co-ordinates of the ball
+    */
     void draw(N5110 &lcd);
+    /** 
+    * @brief Resets all the variable counters for the ball
+    */    
     void reset();
+     /** 
+    * @brief Resets the ball count for starting each game
+    */ 
     void reset_ball_count();
-    
-    /// accessors and mutators
+     /** 
+    * @brief Starts the ball from a set position
+    * @details The ball's y co-ordinate is incremented during each untill the target co-odinates are reached
+    * @param &pad @details Takes a reference pointer to a Gamepad object
+    * @returns returns an int with 1 signifiying that the ball has reached the target co-ordinates and 0 if false
+    */
     int ball_start(Gamepad &pad);
-    void get_direction(Gamepad &pad);
+    
+    //GETTER METHODS
+    void get_direction(Gamepad &pad); 
+    /** 
+    * @brief Returns the no. of balls played at the point in the game
+    * @returns an integer value representing the no. of balls played at that point
+    */ 
     int get_ball_count();
-
+    
     //void update_ball(int checkHit, Direction dir);
+    /** 
+    * @brief Starts the ball from a set position
+    * @details The ball's cordinates are adjusted according to the expected x and y cordinates
+    * @param expected_x @details The expected x cordinate according to the direction of the ball
+    * @param expected_y @details The expected y cordinate according to the direction of the ball
+    * @returns returns an int with 1 if the expected co-ordinates have been reached
+    */
     int update_ball(int expected_x,int expected_y);
+    /** 
+    * @brief The bowler starts running in for each round
+    * @details The bowler starts from y co-ordinate 0 and stops at y-ordinate 16
+    * @details The y-ordinate of the bowler is incremented with each call till target co-ordinate is reached
+    * @returns an integer value that returns 1 if target co-ordinate is reached and 0 if it hasn't
+    */ 
     int bowler_start(Gamepad &pad);
+     /** 
+    * @brief Increments the _ball_count variable during each call
+    */
     void increment_ball_count();
     
 private:
@@ -40,13 +80,25 @@
     };
     int fieldNumbers[10];
     Bat bat;
+    
+    //Integer variable that stores the no. of balls played during the game
     int _ball_count;
+    /*Integer value that dictates if the bowler has bowled the ball
+    the value is set to 1 if the bowler_start returns 1
+    */
     int _bowled;
+    //flag used to check if tone has to be played during each round
     int _set_tone;
     int d;
+    // Integer variable to store the size of the ball
     int _size;
+    //Integer variable to store the x co-rdinate of the ball
     int _x;
+    //Integer variable to store the y co-ordinate of the ball
     int _y;
+    
+    // X and Y cordinates of the bowlder
+    //CHANGE VARIABLE NAME
     int _x1;
     int _y1;
 };