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

Dependencies:   mbed

Revision:
133:eed60548d170
Parent:
130:4ce67451d0c1
Child:
134:2da2db5871bd
--- a/Alien/Alien.cpp	Mon May 06 14:35:54 2019 +0000
+++ b/Alien/Alien.cpp	Wed May 08 18:54:03 2019 +0000
@@ -1,7 +1,6 @@
 #include "Alien.h"
 
 
-
 Alien::Alien()
 {
 
@@ -19,25 +18,76 @@
     _x_alien = x_alien;
     _y_alien = y_alien;
     _speed_alien = speed_alien;
+    _alive = true;
 
 }
 
 void Alien::draw(N5110 &lcd)
 {
-    lcd.drawRect(_x_alien,_y_alien,_x_alien+5,_y_alien+5,FILL_BLACK);
-}
+    
+    lcd.drawSprite(_x_alien,_y_alien,32,32,(int *)alien2);
+    }
+    
+
+
+//void Alien::killed(){_dead = true; _x_alien = 0; _y_alien = 0;}
 
 void  Alien::update(Direction d,float mag)
 {
     _speed_alien = int(mag*10.0f);
+            }
 
-    /*if (_hit_enemy <_x_bullet) {
-        _hit_enemy=1;
-    } else {
-        _hit_enemy=0;
-    }
-    */
+        srand(time(NULL));
+        _y_alien += rand() % 17 - 8; 
+        
+        
+        if(_y_alien>=30){
+            _y_alien=30;
+            }
+        else
+        if(_y_alien<=0){
+            _y_alien=0;
+            }
+    
+}
 
 
 
+int  Alien::get_pos_x()
+{
+    return _x_alien;
 }
+
+int Alien::get_pos_y()
+{
+    return _y_alien;
+}
+
+void Alien::set_pos(int x, int y)
+{
+    _x_alien = x;
+    _y_alien = y;
+}
+
+void Alien::add_score()
+
+{
+    _score++;
+}
+int Alien::get_score()
+{
+    return _score;
+    }
+
+bool Alien::isAlive()
+{
+    return _alive;
+}
+
+void Alien::setAlive(bool alive)
+{
+    _alive = alive;
+}     
+
+  
+