Steven Mahasin / Mbed 2 deprecated DreamDungeon

Dependencies:   mbed MotionSensor

Revision:
23:5a8f75e93508
Parent:
22:7abf4581bc9b
Child:
27:a1b41626f57c
--- a/Entity/Player/Player.h	Thu Apr 25 05:53:30 2019 +0000
+++ b/Entity/Player/Player.h	Thu Apr 25 23:15:44 2019 +0000
@@ -7,6 +7,21 @@
 
 class Player : public Entity
 {
+private:
+
+    // Member Variables
+    struct SpriteDisplay {
+        int width;
+        int height;
+        int * sprite;
+    };
+    SpriteDisplay hearts;
+    int fire_rate_counter;
+    int fire_rate_delay;
+    int _bullet_speed;
+    const static int invulnerability_period = 50;
+    int invulnerability_counter;
+    
 public:
     // Constructors
     Player(float, float);
@@ -14,18 +29,48 @@
     // Functions
     virtual void move(float, float);
     virtual int * get_frame();
+    virtual void take_damage(int);
     void buttons(bool, bool, bool, bool);
+    void update_hearts();
+    int get_hearts_width();
+    int get_hearts_height();
+    int * get_hearts_sprite();
 
     // accessors
-    int get_attack();
     int get_bullet_speed();
 
     // variables
     Bullets *bullets_array[bullets_max];
     bool valid_bullets[bullets_max];
-    int fire_rate_counter;
-    int fire_rate_delay;
-    int _bullet_speed;
+    
+};
+
+// Sprite
+const int sprite_heart[9][9] = {
+    {0,1,1,0,0,0,1,1,0,},
+    {1,1,1,1,0,1,1,1,1,},
+    {1,2,1,1,1,1,1,1,1,},
+    {1,2,1,1,1,1,1,1,1,},
+    {1,2,1,1,1,1,1,1,1,},
+    {0,1,2,1,1,1,1,1,0,},
+    {0,0,1,1,1,1,1,0,0,},
+    {0,0,0,1,1,1,0,0,0,},
+    {0,0,0,0,1,0,0,0,0,}
+};
+
+const int sprite_transparent_player[12][6] = {
+    {0,0,0,0,0,0,},
+    {0,0,0,0,0,0,},
+    {0,0,0,0,0,0,},
+    {0,0,0,0,0,0,},
+    {0,0,0,0,0,0,},
+    {0,0,0,0,0,0,},
+    {0,0,0,0,0,0,},
+    {0,0,0,0,0,0,},
+    {0,0,0,0,0,0,},
+    {0,0,0,0,0,0,},
+    {0,0,0,0,0,0,},
+    {0,0,0,0,0,0,}
 };
 
 const int sprite_player [4][4][12][6] = {   // Player [Face][SpriteAnimationFrame][Size_Y][Size_X]