Steven Mahasin / Mbed 2 deprecated DreamDungeon

Dependencies:   mbed MotionSensor

Revision:
14:3361879490b2
Parent:
13:d04a6caba40d
Child:
15:44d5cc33d389
diff -r d04a6caba40d -r 3361879490b2 Entity/Bullets/Bullets.cpp
--- a/Entity/Bullets/Bullets.cpp	Wed Apr 24 02:33:33 2019 +0000
+++ b/Entity/Bullets/Bullets.cpp	Wed Apr 24 03:09:00 2019 +0000
@@ -16,10 +16,30 @@
 }
 
 void Bullets::move(float speed, float unused){
-    position.x += (direction < 2)*speed;
-    position.y += (direction < 2)*speed;
+    if (direction == 0){
+        position.y -= speed;
+    }
+    else if (direction == 1){
+        position.x += speed;
+    }
+    else if (direction == 2){
+        position.y += speed;
+    }
+    else if (direction == 3){
+        position.x -= speed;
+    }
 }
 
 int * Bullets::get_frame(){
     return (int *) bullets_sprite;
+}
+
+bool Bullets::out_of_bounds_check(){
+    if (matrix_collision_test(position.x, position.y, 0)){
+        return true;
+    }
+    else if ((!(0 < position.x < 84)) || (!(0 < position.y < 48))){
+        return true;
+    }
+    return false;
 }
\ No newline at end of file