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
Health.h
00001 #ifndef HEALTH_H 00002 #define HEALTH_H 00003 #include "Entity.h" 00004 00005 /**Health Class 00006 @author Steven Mahasin 00007 @brief Creates a Health which inherits the Entity class, this is a collectible entity that the player interracts with to gain health points. 00008 @date May 2019 00009 */ 00010 class Health : public Entity 00011 { 00012 public: 00013 /** Constructor 00014 * @brief creates a heart that heals when picked up 00015 * @param pos_x @details initialise _position.x 00016 * @param pos_y @details initialise _position.y 00017 */ 00018 Health(float pos_x, float pos_y); 00019 00020 // Functions 00021 /** 00022 * @brief just because entity has a pure virtual function move, the function is of no use in health as it does not move 00023 * @param unused @details not used 00024 * @param unused1 @details not used 00025 * @param unused2 @details not used 00026 * @param unused3 @details not used 00027 */ 00028 virtual void move(float unused, float unused1, char *unused2, bool *unused3); 00029 /** 00030 * @brief reduce _hp by damage 00031 * @param damage @details the amount of damage to be taken 00032 */ 00033 virtual void take_damage(int damage); 00034 /** 00035 * @brief a virtual function of drawing the health onto the screen 00036 * @param lcd @details the screen where the health is drawn on 00037 */ 00038 virtual void draw(N5110 &lcd); 00039 }; 00040 00041 const char health_sprite[7][7] = { 00042 {0,1,1,0,1,1,0}, 00043 {1,1,1,1,1,1,1}, 00044 {1,0,1,1,1,1,1}, 00045 {1,0,1,1,1,1,1}, 00046 {0,1,0,1,1,1,0}, 00047 {0,0,1,1,1,0,0}, 00048 {0,0,0,1,0,0,0} 00049 }; 00050 00051 #endif
Generated on Tue Jul 19 2022 23:32:07 by
1.7.2