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:
- 13:d04a6caba40d
- Parent:
- 12:a1c1991835ca
- Child:
- 14:3361879490b2
diff -r a1c1991835ca -r d04a6caba40d Entity/Entity.h --- a/Entity/Entity.h Tue Apr 23 22:59:12 2019 +0000 +++ b/Entity/Entity.h Wed Apr 24 02:33:33 2019 +0000 @@ -39,38 +39,16 @@ int face; public: - // Functions - bool matrix_collision_test(float pos_x, float pos_y, int map_no){ - for (int j = pos_y; j < (int)pos_y + hitbox.height; j++){ - for(int i = pos_x; i < (int)pos_x + hitbox.width; i++){ - if ((j>=48) || (i>=84) || (j<0) || (i<0)) {} - else if ((level_map[0][j][i] == 1)) { - return true; - } - } - } - return false; - } - + // Function virtual void move(float, float) = 0; // movement control and miscellaneous updates - virtual int * get_frame() = 0; - - virtual void chkdmg() = 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); - void undo_move_x(bool status_x){ - if (status_x){ - position.x = prev_pos.x; - } - } - - void undo_move_y(bool status_y){ - if (status_y){ - position.y = prev_pos.y; - } - } - - void update_prev_pos(); + // Mutator // Accessors bool get_moving();