Ikenna Adrian Ozoemena 201157039

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Health.h Source File

Health.h

00001 #ifndef HEALTH_H
00002 #define HEALTH_H
00003 
00004 #include "mbed.h"
00005 #include "N5110.h"
00006 #include "Gamepad.h"
00007 #include "Ship.h"
00008 
00009 /** Health Class
00010 @brief Library for handling ship and enemy health
00011 @author Ozoemena Adrian Ikenna
00012 @date 8th May 2019
00013 */
00014 class Health
00015 {
00016 
00017 public:
00018     /** constructor */
00019     Health();
00020     /** destructor */
00021     ~Health();
00022     /** A mutator method that initializes the slass by setting the ship being used
00023     *< as different ships have different amounts of health and shiekds 
00024     *@param shipUsed a variable of enum SHIP which contains the ship currently being used
00025     */
00026     void init(SHIP shipUsed);
00027     /** draws the health bar based on ship selected
00028     *@param &lcd address of the N5110 library used for the lcd display
00029     *@param shipUsed a variable of enum SHIP which contains the ship currently being used 
00030     */
00031     void draw_health(N5110 &lcd,SHIP shipUsed);
00032     /** draws the shield bar based on ship selected
00033     *@param &lcd address of the N5110 library used for the lcd display
00034     */
00035     void draw_shields(N5110 &lcd);
00036     /** A mutator method used to change the shield and health values when damahe is taken
00037     *@param bars a unit of health and damage. (e.g 3 bars of health)
00038     *@param &pad address of the gamepad library used to read inputs and send outputs to the gamepad
00039     */
00040     void update(int bars,Gamepad &pad);
00041     /** An accessor method used to get the current health and shield level of a ship
00042     *@returns 2D vector hp with hp.x being ship health and hp.y ship shields
00043     */
00044     Vector2D get_hp();
00045     /** A Mutator method used to update the enemy seekers health
00046     *@param seno: the seeker number used to reference the seeker of interest
00047     *Ranges from 0-3 as there can be a maximum of three seekers
00048     *@param dmg the amount of damage done to the enemy by player
00049     */
00050     void seekerh_update(int seno,int dmg);
00051     /** A Mutator method used to update the enemy shooters health
00052     *@param shno: the shooter number used to reference the shooter of interest
00053     *Ranges from 0-3 as there can be a maximum of three shooters
00054     *@param dmg the amount of damage done to the enemy by player
00055     */
00056     void shooterh_update(int shno, int dmg);
00057     /** An Accessor method used to get the seekers health 
00058     *@param seno the seeker number used to reference the seeker of interest
00059     *Ranges from 0-3 as there can be a maximum of three seekers
00060     */
00061     int get_seekerh(int seno);
00062     /** An Accessor method used to get the shooters health 
00063     *@param shno the shooter number used to reference the shooter of interest
00064     *Ranges from 0-3 as there can be a maximum of three shooters
00065     */
00066     int get_shooterh(int shno);
00067     /** A Mutator method used to reset the seekers health upon death or game restart
00068     *@param seno the seeker number used to reference the seeker of interest
00069     *Ranges from 0-3 as there can be a maximum of three seekers
00070     */
00071     void reset_seekerh(int seno);
00072     /** A Mutator method used to reset the shooters health upon death or game restart
00073     *@param shno the shooter number used to reference the shooter of interest
00074     *Ranges from 0-3 as there can be a maximum of three shooters
00075     */
00076     void reset_shooterh(int shno);    
00077     
00078 private:
00079 //_______________Private-Variables__________________________________________
00080     int _ship_health;   // the ships health
00081     int _ship_shields;  // the ships shield (sheilds differ from health as they recharge over time)
00082     int _health_unit;   // 1 unit of health (differs from ship to ship)
00083     int _seekerH[3];    // array of seeker health values
00084     int _shooterH[3];   // array of shooter health values
00085 
00086 };
00087 
00088 #endif