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.cpp
- Revision:
- 60:44ddfb791e2b
- Parent:
- 57:1c12361b6e3d
diff -r fd4669864b67 -r 44ddfb791e2b Health/Health.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Health/Health.cpp Thu May 09 14:55:43 2019 +0000
@@ -0,0 +1,37 @@
+#include "Health.h"
+
+Health::Health(float pos_x, float pos_y)
+{
+ _hp = 1;
+ _attack = -1;
+
+ _hitbox.width = 7;
+ _hitbox.height = 7;
+
+ _position.x = pos_x;
+ _position.y = pos_y;
+
+ _sprite_size.width = 7;
+ _sprite_size.height = 7;
+ _sprite_size.offset_x = 0;
+ _sprite_size.offset_y = 0;
+}
+
+void Health::move(float unused, float unused1, char * unused2, bool * unused3) // Health doesnt move, only typed out since the virtual function is pure
+{
+
+}
+
+void Health::draw(N5110 &lcd)
+{
+ lcd.drawSpriteTransparent(_position.x+_sprite_size.offset_x,
+ _position.y+_sprite_size.offset_y,
+ _sprite_size.height,
+ _sprite_size.width,
+ (char *) health_sprite);
+}
+
+void Health::take_damage(int damage)
+{
+ _hp -= damage;
+}
\ No newline at end of file