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: Entity/Player/Player.h
- Revision:
- 27:a1b41626f57c
- Parent:
- 23:5a8f75e93508
- Child:
- 29:6b8411bb040a
diff -r abbc19edc5c1 -r a1b41626f57c Entity/Player/Player.h
--- a/Entity/Player/Player.h Mon Apr 29 02:45:17 2019 +0000
+++ b/Entity/Player/Player.h Mon Apr 29 10:39:09 2019 +0000
@@ -10,12 +10,6 @@
private:
// Member Variables
- struct SpriteDisplay {
- int width;
- int height;
- int * sprite;
- };
- SpriteDisplay hearts;
int fire_rate_counter;
int fire_rate_delay;
int _bullet_speed;
@@ -25,13 +19,14 @@
public:
// Constructors
Player(float, float);
+ // Deconstructors
+ ~Player();
// Functions
- virtual void move(float, float);
+ virtual void move(float, float, int * map);
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();
@@ -58,6 +53,80 @@
{0,0,0,0,1,0,0,0,0,}
};
+const int sprite_dying_player [5][12][12] = { // sprite_dying_player [Frame][Size_Y][Size_X]
+ {
+ {0,1,1,1,1,0,0,0,0,0,0,0,},
+ {1,1,1,1,1,1,0,0,0,0,0,0,},
+ {1,2,1,1,1,1,0,0,0,0,0,0,},
+ {1,1,1,1,1,1,0,0,0,0,0,0,},
+ {0,1,1,1,1,0,0,0,0,0,0,0,},
+ {0,0,1,1,0,0,0,0,0,0,0,0,},
+ {0,0,1,1,0,0,0,0,0,0,0,0,},
+ {0,0,1,1,0,0,0,0,0,0,0,0,},
+ {0,0,1,1,0,0,0,0,0,0,0,0,},
+ {0,0,0,1,0,0,0,0,0,0,0,0,},
+ {0,0,0,1,0,0,0,0,0,0,0,0,},
+ {0,0,1,1,0,0,0,0,0,0,0,0,},
+ },
+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