Steven Mahasin / Mbed 2 deprecated DreamDungeon

Dependencies:   mbed MotionSensor

Revision:
29:6b8411bb040a
Parent:
28:98848e6a77a2
Child:
30:ec915d24d3e9
--- a/Entity/Player/Player.cpp	Thu May 02 21:30:49 2019 +0000
+++ b/Entity/Player/Player.cpp	Sat May 04 15:39:20 2019 +0000
@@ -34,19 +34,14 @@
 
 Player::~Player()
 {
-    for (int i = 0; i < bullets_max; i++) {
-        if (valid_bullets[i]) {
-            delete bullets_array[i];
-            valid_bullets[i] = false;
-        }
-    }
+    delete_bullets();
 }
 
 // Accessors
 int Player::get_bullet_speed()
 {
     return _bullet_speed;
-};
+}
 int Player::get_hearts_width()
 {
     return 9;
@@ -61,12 +56,12 @@
 }
 
 // Functions
-void Player::move(float mapped_x, float mapped_y, int * map)
+void Player::move(float mapped_x, float mapped_y, int * map, bool * doorways)
 {
-    if(!matrix_collision_test(position.x + velocity*mapped_x, position.y, map)) {
+    if(!entity_to_map_collision_test(position.x + velocity*mapped_x, position.y, map, doorways)) {
         position.x += velocity*mapped_x;
     }
-    if(!matrix_collision_test(position.x, position.y - velocity*mapped_y, map)) {
+    if(!entity_to_map_collision_test(position.x, position.y - velocity*mapped_y, map, doorways)) {
         position.y -= velocity*mapped_y;
     }
     moving = false;
@@ -106,6 +101,15 @@
         hp = 5;
     }
 }
+void Player::delete_bullets()
+{
+    for (int i = 0; i < bullets_max; i++) {
+        if (valid_bullets[i]) {
+            delete bullets_array[i];
+            valid_bullets[i] = false;
+        }
+    }
+}
 
 int * Player::get_frame()
 {