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

Dependencies:   mbed MotionSensor

Revision:
51:4d0cd75e7ed3
Parent:
41:0697508a28ba
Child:
57:1c12361b6e3d
--- a/Entity/Entity.cpp	Thu May 09 06:33:28 2019 +0000
+++ b/Entity/Entity.cpp	Thu May 09 07:39:49 2019 +0000
@@ -1,15 +1,15 @@
 #include "Entity.h"
 
 // Functions
-void Entity::undo_move_x(bool status_x)
+void Entity::undo_move_x(bool condition)
 {
-    if (status_x) {
+    if (condition) {
         position.x = prev_pos.x;
     }
 }
-void Entity::undo_move_y(bool status_y)
+void Entity::undo_move_y(bool condition)
 {
-    if (status_y) {
+    if (condition) {
         position.y = prev_pos.y;
     }
 }
@@ -18,12 +18,12 @@
     prev_pos = position;
 }
 
-bool Entity::entity_to_map_collision_test(float pos_x, float pos_y, char * map, bool * doorways)
+bool Entity::entity_to_map_collision_test(float pos_x, float pos_y, char * two_d_map, bool * doorways)    // Returns true if the entity clashes a wall
 {      
     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>=screen_height) || (i>=screen_width) || (j<0) || (i<0)) {} // To allow movement towards outside of the map
-            else if (*((map+j*screen_width)+i) == 1) {
+            else if (*((two_d_map+j*screen_width)+i) == 1) {  // if entity clashes the 2d map
                 return true;
             }
             
@@ -62,11 +62,7 @@
     position.y += change_y;
 }
 
-// accessors
-bool Entity::get_moving()
-{
-    return moving;
-}
+// Accessors
 int Entity::get_hp_drop_chance()
 {
     return _hp_drop_chance;