Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: Bat/Bat.h
- Revision:
- 28:d0b0a64a832d
- Parent:
- 26:6427f09cf8d3
- Child:
- 29:f7a2d2a755ec
--- a/Bat/Bat.h Wed May 01 23:01:44 2019 +0000
+++ b/Bat/Bat.h Tue May 07 17:50:58 2019 +0000
@@ -17,23 +17,57 @@
public:
Bat();
~Bat();
+ /**
+ * @brief Initlialises the Bat class
+ * @details Sets the Bat's position and sets the batting variables to 0
+ */
void init(int x,int y);
+ /**
+ * @brief Prints the bat to the LCD at the inititialised co-ordinates
+ * @param &lcd @details reference object for a N5110 class object
+ */
void draw(N5110 &lcd);
+ /**
+ * @brief Resets the batting variables to 0
+ * param &lcd @details reference pointer for the LCD
+ */
void reset();
- /// accessors and mutators
+ //accessors and mutators
+ /**
+ * @brief Checks if the ball has been hit with the bat during each round
+ * @param @ux @details takes a UserExperience object to check if Button A has been pressed
+ * @returns a boolean value true if ball has been hit during the round and false if ball was missed
+ */
int get_hitBall(UX &ux);
+ /**
+ * @brief Checks if the hit was a lofted hit
+ * @param @ux @details takes a UserExperience object to check if Button L has been pressed
+ * @returns a boolean value true if button L is pressed during the round and false if button L is not pressed
+ */
int get_loft_ball(UX &ux);
private:
+ // Seperate Gamepad has been used in this class because Gamepad obect
+ //from the main class had issues with the CHECK_EVENT Function. The function was not responsive
+ // and could not be resolved and as a result the only suitable solution was to create another object
- Gamepad batPad;
+ //integer variable used to check if ball is Hit, the variable is essentially used as a flag
+ // in the cricket method
int _hitBall;
+
+ //integer variable used to check if the hit is lofted, the variable is essentially used as a flag
+ // in the cricket class
int _loft_ball;
+
+ //Direction of the ball
int d;
+
+ //x co-ordinate for the bat to be printed on the LCD
int _bat_x;
+ //y co-ordinate for the bat to be printed on the LCD
int _bat_y;
};
#endif
\ No newline at end of file