Ikenna Adrian Ozoemena 201157039

Dependencies:   mbed

Committer:
ikenna1
Date:
Thu May 09 14:52:52 2019 +0000
Revision:
53:3fdc4486f672
Parent:
51:2231e2e141b9
Final Submission

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ikenna1 17:e65a9f981834 1 #ifndef HEALTH_H
ikenna1 17:e65a9f981834 2 #define HEALTH_H
ikenna1 17:e65a9f981834 3
ikenna1 17:e65a9f981834 4 #include "mbed.h"
ikenna1 17:e65a9f981834 5 #include "N5110.h"
ikenna1 17:e65a9f981834 6 #include "Gamepad.h"
ikenna1 43:500b8cff3715 7 #include "Ship.h"
ikenna1 17:e65a9f981834 8
ikenna1 45:fe5fc85a5c73 9 /** Health Class
ikenna1 45:fe5fc85a5c73 10 @brief Library for handling ship and enemy health
ikenna1 45:fe5fc85a5c73 11 @author Ozoemena Adrian Ikenna
ikenna1 45:fe5fc85a5c73 12 @date 8th May 2019
ikenna1 45:fe5fc85a5c73 13 */
ikenna1 17:e65a9f981834 14 class Health
ikenna1 17:e65a9f981834 15 {
ikenna1 17:e65a9f981834 16
ikenna1 17:e65a9f981834 17 public:
ikenna1 45:fe5fc85a5c73 18 /** constructor */
ikenna1 17:e65a9f981834 19 Health();
ikenna1 45:fe5fc85a5c73 20 /** destructor */
ikenna1 17:e65a9f981834 21 ~Health();
ikenna1 45:fe5fc85a5c73 22 /** A mutator method that initializes the slass by setting the ship being used
ikenna1 45:fe5fc85a5c73 23 *< as different ships have different amounts of health and shiekds
ikenna1 47:5ae8668af63f 24 *@param shipUsed a variable of enum SHIP which contains the ship currently being used
ikenna1 45:fe5fc85a5c73 25 */
ikenna1 44:a6a361bea806 26 void init(SHIP shipUsed);
ikenna1 45:fe5fc85a5c73 27 /** draws the health bar based on ship selected
ikenna1 51:2231e2e141b9 28 *@param &lcd address of the N5110 library used for the lcd display
ikenna1 47:5ae8668af63f 29 *@param shipUsed a variable of enum SHIP which contains the ship currently being used
ikenna1 45:fe5fc85a5c73 30 */
ikenna1 44:a6a361bea806 31 void draw_health(N5110 &lcd,SHIP shipUsed);
ikenna1 45:fe5fc85a5c73 32 /** draws the shield bar based on ship selected
ikenna1 51:2231e2e141b9 33 *@param &lcd address of the N5110 library used for the lcd display
ikenna1 45:fe5fc85a5c73 34 */
ikenna1 17:e65a9f981834 35 void draw_shields(N5110 &lcd);
ikenna1 45:fe5fc85a5c73 36 /** A mutator method used to change the shield and health values when damahe is taken
ikenna1 47:5ae8668af63f 37 *@param bars a unit of health and damage. (e.g 3 bars of health)
ikenna1 51:2231e2e141b9 38 *@param &pad address of the gamepad library used to read inputs and send outputs to the gamepad
ikenna1 45:fe5fc85a5c73 39 */
ikenna1 28:6319e928f0aa 40 void update(int bars,Gamepad &pad);
ikenna1 45:fe5fc85a5c73 41 /** An accessor method used to get the current health and shield level of a ship
ikenna1 45:fe5fc85a5c73 42 *@returns 2D vector hp with hp.x being ship health and hp.y ship shields
ikenna1 45:fe5fc85a5c73 43 */
ikenna1 28:6319e928f0aa 44 Vector2D get_hp();
ikenna1 45:fe5fc85a5c73 45 /** A Mutator method used to update the enemy seekers health
ikenna1 45:fe5fc85a5c73 46 *@param seno: the seeker number used to reference the seeker of interest
ikenna1 45:fe5fc85a5c73 47 *Ranges from 0-3 as there can be a maximum of three seekers
ikenna1 47:5ae8668af63f 48 *@param dmg the amount of damage done to the enemy by player
ikenna1 45:fe5fc85a5c73 49 */
ikenna1 39:7824f9080f59 50 void seekerh_update(int seno,int dmg);
ikenna1 45:fe5fc85a5c73 51 /** A Mutator method used to update the enemy shooters health
ikenna1 45:fe5fc85a5c73 52 *@param shno: the shooter number used to reference the shooter of interest
ikenna1 45:fe5fc85a5c73 53 *Ranges from 0-3 as there can be a maximum of three shooters
ikenna1 47:5ae8668af63f 54 *@param dmg the amount of damage done to the enemy by player
ikenna1 45:fe5fc85a5c73 55 */
ikenna1 36:c25417f0d150 56 void shooterh_update(int shno, int dmg);
ikenna1 45:fe5fc85a5c73 57 /** An Accessor method used to get the seekers health
ikenna1 47:5ae8668af63f 58 *@param seno the seeker number used to reference the seeker of interest
ikenna1 45:fe5fc85a5c73 59 *Ranges from 0-3 as there can be a maximum of three seekers
ikenna1 45:fe5fc85a5c73 60 */
ikenna1 39:7824f9080f59 61 int get_seekerh(int seno);
ikenna1 45:fe5fc85a5c73 62 /** An Accessor method used to get the shooters health
ikenna1 47:5ae8668af63f 63 *@param shno the shooter number used to reference the shooter of interest
ikenna1 45:fe5fc85a5c73 64 *Ranges from 0-3 as there can be a maximum of three shooters
ikenna1 45:fe5fc85a5c73 65 */
ikenna1 36:c25417f0d150 66 int get_shooterh(int shno);
ikenna1 45:fe5fc85a5c73 67 /** A Mutator method used to reset the seekers health upon death or game restart
ikenna1 47:5ae8668af63f 68 *@param seno the seeker number used to reference the seeker of interest
ikenna1 45:fe5fc85a5c73 69 *Ranges from 0-3 as there can be a maximum of three seekers
ikenna1 45:fe5fc85a5c73 70 */
ikenna1 39:7824f9080f59 71 void reset_seekerh(int seno);
ikenna1 45:fe5fc85a5c73 72 /** A Mutator method used to reset the shooters health upon death or game restart
ikenna1 47:5ae8668af63f 73 *@param shno the shooter number used to reference the shooter of interest
ikenna1 45:fe5fc85a5c73 74 *Ranges from 0-3 as there can be a maximum of three shooters
ikenna1 45:fe5fc85a5c73 75 */
ikenna1 36:c25417f0d150 76 void reset_shooterh(int shno);
ikenna1 36:c25417f0d150 77
ikenna1 17:e65a9f981834 78 private:
ikenna1 45:fe5fc85a5c73 79 //_______________Private-Variables__________________________________________
ikenna1 51:2231e2e141b9 80 int _ship_health; // the ships health
ikenna1 51:2231e2e141b9 81 int _ship_shields; // the ships shield (sheilds differ from health as they recharge over time)
ikenna1 51:2231e2e141b9 82 int _health_unit; // 1 unit of health (differs from ship to ship)
ikenna1 51:2231e2e141b9 83 int _seekerH[3]; // array of seeker health values
ikenna1 51:2231e2e141b9 84 int _shooterH[3]; // array of shooter health values
ikenna1 17:e65a9f981834 85
ikenna1 17:e65a9f981834 86 };
ikenna1 17:e65a9f981834 87
ikenna1 17:e65a9f981834 88 #endif