ELEC2645 (2018/19) / Mbed 2 deprecated el17szs

Dependencies:   mbed

Revision:
28:d0b0a64a832d
Parent:
26:6427f09cf8d3
Child:
29:f7a2d2a755ec
--- a/Cricket/Cricket.h	Wed May 01 23:01:44 2019 +0000
+++ b/Cricket/Cricket.h	Tue May 07 17:50:58 2019 +0000
@@ -10,30 +10,78 @@
 
 /** Ball Class
 @author Shahid Zubin Sajid
-@brief Controls the ball in the Cricket team 
+@brief GAME ENGINE FOR HERO CRICKET 
 @date May 2019
 */ 
 class Cricket
 {
 
 public:
+    
     Cricket();
     ~Cricket();
+     /** 
+    * @brief Initlialises the Cricket class Object
+    * @details Intialises the bat variables to the starting values
+    * @details Initialises the other class objects used in the game
+    */
     void init();
+     /** 
+    * @brief Draws the fielders, the outfield circle and the pitch onto the LCD
+    */
     void draw(N5110 &lcd);
     
     //Setters
     void set_field(N5110 &lcd);
+     /** 
+    * @brief Method to set the cor-dinates,direction and position for batsman to hit the ball
+    * @param x @details Integer value for the x-cordinate
+    * @param y @details Integer value for the y-cordinate
+    * @param direction @details Direction variable to set the position direction
+    * @param no @details integer to store the position number
+    */
     void set_init_positions(int x,int y, Direction direction,int no);
-    void set_ball_direction(Direction dir);
-    
-    //
+    /** 
+    * @brief Sets the ball direction and sets _direction_set to 1
+    * @details loops through the positions available and sets the direction to the arguement if found
+    * @param dir @details Direction variable recieved as recived from the joystick during gameplay
+    */
+    void set_ball_direction(Direction dir); 
+     /** 
+    * @brief Draws the 5 outfield filders to the LCD
+    * @details Loops through the fielders array and prints the fielders acc. to their cordinates
+    * param &lcd @details reference pointer for the LCD
+    */
     void draw_field(N5110 &lcd);
+     /** 
+    * @brief Method to set the cor-dinates,direction and position for batsman to hit the ball
+    * @param x @details Integer value for the x-cordinate
+    * @param y @details Integer value for the y-cordinate
+    * @param direction @details Direction variable to set the position direction
+    * @param no @details integer to store the position number
+    */
     void update_game(int checkHit,int loft_check, Direction dir,Gamepad &pad,N5110 &lcd);
     void play_game(N5110 &lcd,Gamepad &pad);
-    void update_scoreboard(int checkUpdate, int runs,Gamepad &pad);
+    /**
+    * @brief Updates the score by adding runs scored during the round to score
+    * @param checkUpdate @details integer value which validates that the game has been updated
+    * @param runs @details Integer value which stores the runs scored during the round
+    * @param &pad @details Takes a reference pointer to a Gamepad object
+    */
+    void update_scoreboard(int checkUpdate,int runs, Gamepad &pad);
+     /**
+    * @brief method when a batsman is out, screen updates and game resets.
+    * @param option @details integer value which identifies the way batsman is out
+    * @param &pad @details Takes a reference pointer to a Gamepad object
+    * @param &lcd @details reference pointer for the LCD
+    */
     void batsman_out(int option,Gamepad &pad, N5110 &lcd);
+    /**
+    * @brief method which compares score and target, if true game is won and game resets
+    * @param &lcd @details reference pointer for the LCD
+    */
     void check_victory(N5110 &lcd);
+    
     void game(N5110 &lcd,Gamepad &pad); 
     void intro(N5110 &lcd);
     bool game_status(N5110 &lcd);