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

Dependencies:   mbed

Revision:
96:01434284987f
Parent:
92:8a1b14488ca5
Child:
97:58e5b454931f
--- a/Alien/Alien.cpp	Sun May 05 01:38:30 2019 +0000
+++ b/Alien/Alien.cpp	Sun May 05 01:41:53 2019 +0000
@@ -12,81 +12,11 @@
 }
 
 
- int Alien_sprite[12][10] =   {
-    { 0,0,0,0,0,1,1,1,0,0 },
-    { 0,0,0,0,0,1,1,1,0,0 },
-    { 0,0,0,1,1,1,1,0,0,0 },
-    { 0,0,1,1,1,1,0,1,0,0 },
-    { 0,0,1,1,1,1,0,1,0,0 },
-    { 0,0,1,1,1,1,0,1,0,0 },
-    { 0,0,1,1,1,1,0,1,0,0 },
-    { 0,0,1,1,1,1,0,1,0,0 },
-    { 0,0,1,1,1,1,0,1,0,0 },
-    { 0,0,1,1,1,1,0,1,0,0 },
-    { 0,0,1,1,1,1,0,1,0,0 },
-    { 0,0,1,1,1,1,0,1,0,0 },
-
-};
-
-
-
-
-void Alien::init(int size,int speed)
+void Alien::init(int x_alien,int y_alien, int speed_alien)
 {
-
-    _size = size;
-
-
-
-
-
-    srand(time(NULL));
-    int direction = rand() % 8; // randomise initial direction.
-
-    // 4 possibilities. Get random modulo and set velocities accordingly
-    if (direction == 0) {
-        _velocity.x = speed;
-        _velocity.y = speed;
-    } else if (direction == 1) {
-        _velocity.x = speed;
-        _velocity.y = -speed;
-    } else if (direction == 2) {
-        _velocity.x = speed;
-        _velocity.y = speed;
-    } else {
-        _velocity.x = -speed;
-        _velocity.y = -speed;
-    }
-}
-
-
-
-void Alien::draw(N5110&lcd)
-{
-    lcd.drawSprite(x_Alien,y_Alien,12,10,(int *)Alien_sprite);
+   
+    _x_alien = x_alien;
+    _y_alien = y_alien;
+   _speed_alien = speed_alien;
 
 }
-
-void Alien::update()
-{
-    _x += _velocity.x;
-    _y += _velocity.y;
-}
-
-void Alien::set_velocity(Vector2D v)
-{
-    _velocity.x = v.x;
-    _velocity.y = v.y;
-}
-
-Vector2D Alien::get_velocity()
-{
-    Vector2D v = {_velocity.x,_velocity.y};
-    return v;
-}
-
-Vector2D Alien::get_pos()
-{
-    Vector2D p = {_x,_y};
-    return p;
-}