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 MotionSensor
Entity/Collectibles/Health/Health.h@58:c8d90bb7404a, 2019-05-09 (annotated)
- Committer:
- el17sm
- Date:
- Thu May 09 14:43:45 2019 +0000
- Revision:
- 58:c8d90bb7404a
- Parent:
- 37:a404860171a9
- Child:
- 59:fd4669864b67
Fully Doxygenated
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| el17sm | 32:fe6359ef9916 | 1 | #ifndef HEALTH_H |
| el17sm | 32:fe6359ef9916 | 2 | #define HEALTH_H |
| el17sm | 32:fe6359ef9916 | 3 | #include "Entity.h" |
| el17sm | 32:fe6359ef9916 | 4 | |
| el17sm | 58:c8d90bb7404a | 5 | /**Health Class |
| el17sm | 58:c8d90bb7404a | 6 | @author Steven Mahasin |
| el17sm | 58:c8d90bb7404a | 7 | @brief Creates a Health which inherits the Entity class, this is a collectible entity that the player interracts with to gain health points. |
| el17sm | 58:c8d90bb7404a | 8 | @date May 2019 |
| el17sm | 58:c8d90bb7404a | 9 | */ |
| el17sm | 32:fe6359ef9916 | 10 | class Health : public Entity |
| el17sm | 32:fe6359ef9916 | 11 | { |
| el17sm | 32:fe6359ef9916 | 12 | public: |
| el17sm | 58:c8d90bb7404a | 13 | /** Constructor |
| el17sm | 58:c8d90bb7404a | 14 | * @brief creates a heart that heals when picked up |
| el17sm | 58:c8d90bb7404a | 15 | * @param pos_x @details initialise _position.x |
| el17sm | 58:c8d90bb7404a | 16 | * @param pos_y @details initialise _position.y |
| el17sm | 58:c8d90bb7404a | 17 | */ |
| el17sm | 58:c8d90bb7404a | 18 | Health(float pos_x, float pos_y); |
| el17sm | 32:fe6359ef9916 | 19 | |
| el17sm | 32:fe6359ef9916 | 20 | // Functions |
| el17sm | 58:c8d90bb7404a | 21 | /** |
| el17sm | 58:c8d90bb7404a | 22 | * @brief just because entity has a pure virtual function move, the function is of no use in health as it does not move |
| el17sm | 58:c8d90bb7404a | 23 | * @param unused @details not used |
| el17sm | 58:c8d90bb7404a | 24 | * @param unused1 @details not used |
| el17sm | 58:c8d90bb7404a | 25 | * @param unused2 @details not used |
| el17sm | 58:c8d90bb7404a | 26 | * @param unused3 @details not used |
| el17sm | 58:c8d90bb7404a | 27 | */ |
| el17sm | 58:c8d90bb7404a | 28 | virtual void move(float unused, float unused1, char *unused2, bool *unused3); |
| el17sm | 58:c8d90bb7404a | 29 | /** |
| el17sm | 58:c8d90bb7404a | 30 | * @brief reduce _hp by damage |
| el17sm | 58:c8d90bb7404a | 31 | * @param damage @details the amount of damage to be taken |
| el17sm | 58:c8d90bb7404a | 32 | */ |
| el17sm | 58:c8d90bb7404a | 33 | virtual void take_damage(int damage); |
| el17sm | 58:c8d90bb7404a | 34 | /** |
| el17sm | 58:c8d90bb7404a | 35 | * @brief a virtual function of drawing the health onto the screen |
| el17sm | 58:c8d90bb7404a | 36 | * @param lcd @details the screen where the health is drawn on |
| el17sm | 58:c8d90bb7404a | 37 | */ |
| el17sm | 58:c8d90bb7404a | 38 | virtual void draw(N5110 &lcd); |
| el17sm | 32:fe6359ef9916 | 39 | }; |
| el17sm | 32:fe6359ef9916 | 40 | |
| el17sm | 34:1d5b4da3935e | 41 | const char health_sprite[7][7] = { |
| el17sm | 32:fe6359ef9916 | 42 | {0,1,1,0,1,1,0}, |
| el17sm | 32:fe6359ef9916 | 43 | {1,1,1,1,1,1,1}, |
| el17sm | 32:fe6359ef9916 | 44 | {1,0,1,1,1,1,1}, |
| el17sm | 32:fe6359ef9916 | 45 | {1,0,1,1,1,1,1}, |
| el17sm | 32:fe6359ef9916 | 46 | {0,1,0,1,1,1,0}, |
| el17sm | 32:fe6359ef9916 | 47 | {0,0,1,1,1,0,0}, |
| el17sm | 32:fe6359ef9916 | 48 | {0,0,0,1,0,0,0} |
| el17sm | 32:fe6359ef9916 | 49 | }; |
| el17sm | 32:fe6359ef9916 | 50 | |
| el17sm | 32:fe6359ef9916 | 51 | #endif |