ELEC2645 (2018/19) / Mbed 2 deprecated el17szs

Dependencies:   mbed

Bat/Bat.h

Committer:
shahidsajid
Date:
2019-05-07
Revision:
29:f7a2d2a755ec
Parent:
28:d0b0a64a832d
Child:
30:43aace0fdbdf

File content as of revision 29:f7a2d2a755ec:

#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 Febraury 2017
*/ 
class Bat
{

public:
    /** 
    * @brief Constructor for the Bat Class
    */
    Bat();
    /** 
    * @brief Deconstructor for the Bat Class
    */
    ~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
      /** 
    * @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:

    /*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