Steven Mahasin / Mbed 2 deprecated DreamDungeon

Dependencies:   mbed MotionSensor

Revision:
29:6b8411bb040a
Parent:
28:98848e6a77a2
--- a/Entity/Snake/Snake.cpp	Thu May 02 21:30:49 2019 +0000
+++ b/Entity/Snake/Snake.cpp	Sat May 04 15:39:20 2019 +0000
@@ -12,14 +12,14 @@
     face = 0;
     hp = 4;
     attack = 1;
-    hitbox.width = 6;
-    hitbox.height = 5;
+    hitbox.width = 4;
+    hitbox.height = 7;
     position.x = pos_x;
     position.y = pos_y;
     sprite_size.width = 6;
-    sprite_size.height = 9;
-    sprite_size.offset_x = 0;
-    sprite_size.offset_y = 4;
+    sprite_size.height = 12;
+    sprite_size.offset_x = 1;
+    sprite_size.offset_y = 6;
     frame.count = 0;
     frame.number = 0;
     frame.max = 6;
@@ -48,7 +48,7 @@
 }
 
 // Functions
-void Snake::move(float player_x, float player_y, int * map)
+void Snake::move(float player_x, float player_y, int * map, bool * doorways)
 {
     std::complex<double> pos_diff(player_x - position.x, player_y - position.y); // defining difference in position as a vector
     velocity = velocity_pattern[_velocity_index]; // Creating slithering effect, changing velocity of movement
@@ -86,8 +86,8 @@
         update_hitbox(7, 4, 12, 7, 0, 4, 4);
     }
 
-    undo_move_x(matrix_collision_test(position.x, prev_pos.y, map));
-    undo_move_y(matrix_collision_test(prev_pos.x, position.y, map));
+    undo_move_x(entity_to_map_collision_test(position.x, prev_pos.y, map, doorways));
+    undo_move_y(entity_to_map_collision_test(prev_pos.x, position.y, map, doorways));
 
     frame.count++;
     if (frame.count >= 10) {