Laila Al Badwawi 200906179 SpaceInvaders I declare this my own independent work and understand the university rules on plagiarism.

Dependencies:   mbed

Revision:
91:f9e2ff484014
Parent:
90:a992605aeb8d
Child:
92:8a1b14488ca5
--- a/spase_ship/space_ship.cpp	Sun Apr 28 15:21:54 2019 +0000
+++ b/spase_ship/space_ship.cpp	Sun Apr 28 19:44:34 2019 +0000
@@ -36,6 +36,33 @@
     _speed = 1;  // default speed
     _score = 0;  // start score from zero
 
+
+    if (_d2==N) {
+        y=y-2;
+    }
+
+    else if (_d2==E) {
+        bullet_fired=1;
+        x_bullet=11;
+        y_bullet=y;
+    }
+
+    if (y>=40) {
+        y=40;
+    }
+
+    else if(y<=0) {
+        y =0;
+    }
+
+    if(bullet_fired==1) {
+        x_bullet+=4;
+    }
+
+    if(x_bullet>=x_Alien && y_bullet >=y_Alien && y_bullet <=y_Alien+10) {
+        y=0;
+    }
+
 }
 
 void space_ship::draw(N5110 &lcd)
@@ -54,7 +81,8 @@
     return _score;
 }
 
-Vector2D space_ship::get_pos() {
+Vector2D space_ship::get_pos()
+{
     Vector2D p = {_x,_y};
-    return p;    
+    return p;
 }
\ No newline at end of file