A rouge-like rpg, heavily inspired on the binding of isaac. Running on a FRDM-K64F Mbed board. C++.
Dependencies: mbed MotionSensor
Diff: Entity/Entity.h
- Revision:
- 22:7abf4581bc9b
- Parent:
- 16:ddb203a74dfc
- Child:
- 23:5a8f75e93508
diff -r 3c030560e31d -r 7abf4581bc9b Entity/Entity.h --- a/Entity/Entity.h Thu Apr 25 03:32:36 2019 +0000 +++ b/Entity/Entity.h Thu Apr 25 05:53:30 2019 +0000 @@ -4,67 +4,67 @@ #include "math.h" class Entity -{ - protected: - bool moving; - struct Hitbox { - int width; - int height; - }; - Hitbox hitbox; - struct SpriteSize { - int width; - int height; - // Top-left corner of sprite is offset_x - // to the right of top-left corner of hitbox - int offset_x; - // Top-left corner of sprite is offset_y - // above of top-left corner of hitbox - int offset_y; - }; - SpriteSize sprite_size; - struct Position { - float x; - float y; - }; - Position position; - Position prev_pos; - struct FrameCount { - int count; - int number; - int max; - }; - FrameCount frame; - int hp; - int face; - float velocity; - - public: - // Function - virtual void move(float, float) = 0; // movement control and miscellaneous updates - virtual int * get_frame() = 0; - bool matrix_collision_test(float, float, int); - void undo_move_x(bool); - void undo_move_y(bool); - void update_prev_pos(); - void take_damage(int); - bool death_check(); - - // Mutator - - // Accessors - bool get_moving(); - int get_hitbox_width(); - int get_hitbox_height(); - int get_face(); - int get_sprite_width(); - int get_sprite_height(); - int get_offset_x(); - int get_offset_y(); - int get_pos_x(); - int get_pos_y(); - int get_prev_pos_x(); - int get_prev_pos_y(); +{ +protected: + bool moving; + struct Hitbox { + int width; + int height; + }; + Hitbox hitbox; + struct SpriteSize { + int width; + int height; + // Top-left corner of sprite is offset_x + // to the right of top-left corner of hitbox + int offset_x; + // Top-left corner of sprite is offset_y + // above of top-left corner of hitbox + int offset_y; + }; + SpriteSize sprite_size; + struct Position { + float x; + float y; + }; + Position position; + Position prev_pos; + struct FrameCount { + int count; + int number; + int max; + }; + FrameCount frame; + int hp; + int face; + float velocity; + +public: + // Function + virtual void move(float, float) = 0; // movement control and miscellaneous updates + virtual int * get_frame() = 0; + bool matrix_collision_test(float, float, int); + void undo_move_x(bool); + void undo_move_y(bool); + void update_prev_pos(); + void take_damage(int); + bool death_check(); + + // Mutator + + // Accessors + bool get_moving(); + int get_hitbox_width(); + int get_hitbox_height(); + int get_face(); + int get_sprite_width(); + int get_sprite_height(); + int get_offset_x(); + int get_offset_y(); + int get_pos_x(); + int get_pos_y(); + int get_prev_pos_x(); + int get_prev_pos_y(); };