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
Bat/Bat.h
- Committer:
- shahidsajid
- Date:
- 2019-05-08
- Revision:
- 32:1bc731f03a30
- Parent:
- 31:eefa1d23a843
File content as of revision 32:1bc731f03a30:
#ifndef BAT_H
#define BAT_H
#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
#include "UX.h"
/** Bat Class
* @author Shahid Zubin Sajid,
* @brief Bat charactersitics and checks for collisions
* @date May 2019
*/
class Bat
{
public:
/** Constructor */
Bat();
/** Deconstructor */
~Bat();
/**
* @brief Initlialises the Bat class
* @details Sets the Bat's position and sets the batting variables to 0
*/
void init(int width,int height);
/**
* @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
/**
* @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_hit_ball(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:
/*integer variable used to check if ball is Hit, the variable is essentially used as a flag
in the cricket method*/
int _hit_ball;
/*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_width;
//y co-ordinate for the bat to be printed on the LCD
int _bat_height;
};
#endif