A rouge-like rpg, heavily inspired on the binding of isaac. Running on a FRDM-K64F Mbed board. C++.

Dependencies:   mbed MotionSensor

Revision:
21:be18f33da757
Parent:
14:3361879490b2
Child:
23:5a8f75e93508
diff -r bfe410c82b45 -r be18f33da757 Entity/Entity.cpp
--- a/Entity/Entity.cpp	Thu Apr 25 03:56:09 2019 +0000
+++ b/Entity/Entity.cpp	Thu Apr 25 05:27:43 2019 +0000
@@ -1,21 +1,27 @@
 #include "Entity.h"
 
 // functions
-void Entity::undo_move_x(bool status_x){
-    if (status_x){
+void Entity::undo_move_x(bool status_x)
+{
+    if (status_x) {
         position.x = prev_pos.x;
     }
 }
-void Entity::undo_move_y(bool status_y){
-    if (status_y){
+void Entity::undo_move_y(bool status_y)
+{
+    if (status_y) {
         position.y = prev_pos.y;
     }
 }
-void Entity::update_prev_pos(){prev_pos = position;};
+void Entity::update_prev_pos()
+{
+    prev_pos = position;
+};
 
-bool Entity::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++){
+bool Entity::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;
@@ -25,12 +31,14 @@
     return false;
 }
 
-void Entity::take_damage(int damage){
+void Entity::take_damage(int damage)
+{
     hp -= damage;
 }
 
-bool Entity::death_check(){
-    if (hp <= 0){
+bool Entity::death_check()
+{
+    if (hp <= 0) {
         return true;
     }
     return false;
@@ -39,15 +47,51 @@
 // mutators
 
 // accessors
-bool Entity::get_moving(){return moving;}
-int Entity::get_hitbox_width(){return hitbox.width;}
-int Entity::get_hitbox_height(){return hitbox.height;}
-int Entity::get_face(){return face;}
-int Entity::get_sprite_width(){return sprite_size.width;}
-int Entity::get_sprite_height(){return sprite_size.height;}
-int Entity::get_offset_x(){return sprite_size.offset_x;}
-int Entity::get_offset_y(){return sprite_size.offset_y;}
-int Entity::get_pos_x(){return position.x;}
-int Entity::get_pos_y(){return position.y;}
-int Entity::get_prev_pos_x(){return prev_pos.x;}
-int Entity::get_prev_pos_y(){return prev_pos.y;}
\ No newline at end of file
+bool Entity::get_moving()
+{
+    return moving;
+}
+int Entity::get_hitbox_width()
+{
+    return hitbox.width;
+}
+int Entity::get_hitbox_height()
+{
+    return hitbox.height;
+}
+int Entity::get_face()
+{
+    return face;
+}
+int Entity::get_sprite_width()
+{
+    return sprite_size.width;
+}
+int Entity::get_sprite_height()
+{
+    return sprite_size.height;
+}
+int Entity::get_offset_x()
+{
+    return sprite_size.offset_x;
+}
+int Entity::get_offset_y()
+{
+    return sprite_size.offset_y;
+}
+int Entity::get_pos_x()
+{
+    return position.x;
+}
+int Entity::get_pos_y()
+{
+    return position.y;
+}
+int Entity::get_prev_pos_x()
+{
+    return prev_pos.x;
+}
+int Entity::get_prev_pos_y()
+{
+    return prev_pos.y;
+}
\ No newline at end of file