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
Diff: Health/Health.h
- Revision:
- 60:44ddfb791e2b
- Parent:
- 59:fd4669864b67
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Health/Health.h Thu May 09 14:55:43 2019 +0000
@@ -0,0 +1,51 @@
+#ifndef HEALTH_H
+#define HEALTH_H
+#include "Entity.h"
+
+/**Health Class
+*@author Steven Mahasin
+*@brief Creates a Health which inherits the Entity class, this is a collectible entity that the player interracts with to gain health points.
+*@date May 2019
+*/
+class Health : public Entity
+{
+public:
+ /** Constructor
+ * @brief creates a heart that heals when picked up
+ * @param pos_x @details initialise _position.x
+ * @param pos_y @details initialise _position.y
+ */
+ Health(float pos_x, float pos_y);
+
+ // Functions
+ /**
+ * @brief just because entity has a pure virtual function move, the function is of no use in health as it does not move
+ * @param unused @details not used
+ * @param unused1 @details not used
+ * @param unused2 @details not used
+ * @param unused3 @details not used
+ */
+ virtual void move(float unused, float unused1, char *unused2, bool *unused3);
+ /**
+ * @brief reduce _hp by damage
+ * @param damage @details the amount of damage to be taken
+ */
+ virtual void take_damage(int damage);
+ /**
+ * @brief a virtual function of drawing the health onto the screen
+ * @param lcd - the screen where the health is drawn on
+ */
+ virtual void draw(N5110 &lcd);
+};
+
+const char health_sprite[7][7] = {
+ {0,1,1,0,1,1,0},
+ {1,1,1,1,1,1,1},
+ {1,0,1,1,1,1,1},
+ {1,0,1,1,1,1,1},
+ {0,1,0,1,1,1,0},
+ {0,0,1,1,1,0,0},
+ {0,0,0,1,0,0,0}
+};
+
+#endif
\ No newline at end of file