Ikenna Adrian Ozoemena 201157039
Dependencies: mbed
Health/Health.h@45:fe5fc85a5c73, 2019-05-09 (annotated)
- Committer:
- ikenna1
- Date:
- Thu May 09 03:56:41 2019 +0000
- Revision:
- 45:fe5fc85a5c73
- Parent:
- 44:a6a361bea806
- Child:
- 47:5ae8668af63f
Documentation Test 2
Who changed what in which revision?
User | Revision | Line number | New 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 | 45:fe5fc85a5c73 | 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 | 45:fe5fc85a5c73 | 28 | *@param &lcd: pointer to the N5110 library used for the lcd display |
ikenna1 | 45:fe5fc85a5c73 | 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 | 45:fe5fc85a5c73 | 33 | *@param &lcd: pointer to 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 | 45:fe5fc85a5c73 | 37 | *@param bars: a unit of health and damage. (e.g 3 bars of health) |
ikenna1 | 45:fe5fc85a5c73 | 38 | *@param &pad: pointer to 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 | 45:fe5fc85a5c73 | 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 | 45:fe5fc85a5c73 | 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 | 45:fe5fc85a5c73 | 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 | 45:fe5fc85a5c73 | 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 | 45:fe5fc85a5c73 | 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 | 45:fe5fc85a5c73 | 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 | |
ikenna1 | 17:e65a9f981834 | 79 | private: |
ikenna1 | 45:fe5fc85a5c73 | 80 | //_______________Private-Variables__________________________________________ |
ikenna1 | 17:e65a9f981834 | 81 | int _ship_health; |
ikenna1 | 17:e65a9f981834 | 82 | int _ship_shields; |
ikenna1 | 17:e65a9f981834 | 83 | int _shipno; |
ikenna1 | 17:e65a9f981834 | 84 | int _health_unit; |
ikenna1 | 41:e1fa36c0492e | 85 | int _seekerH[3]; |
ikenna1 | 41:e1fa36c0492e | 86 | int _shooterH[3]; |
ikenna1 | 17:e65a9f981834 | 87 | |
ikenna1 | 17:e65a9f981834 | 88 | }; |
ikenna1 | 17:e65a9f981834 | 89 | |
ikenna1 | 17:e65a9f981834 | 90 | #endif |