Reham Faqehi / Mbed 2 deprecated fy15raf

Dependencies:   mbed

Fork of fy15raf by ELEC2645 (2017/18)

Revision:
5:b230e79d36d6
Parent:
4:8c6723798227
Child:
6:7b733b2a6cf6
--- a/Asteroids/Asteroid.cpp	Thu Apr 19 16:54:10 2018 +0000
+++ b/Asteroids/Asteroid.cpp	Thu Apr 19 17:46:28 2018 +0000
@@ -36,4 +36,14 @@
          
     };
     lcd.drawSprite(_x,_y1,7,10,(int *)sprite);
+}
+
+void Asteroid::update()
+{
+    if(_x>0) {
+        _x -= _velocity.x;
+    } else {
+        _x = WIDTH - _size; //start from the begining again
+        _y1= rand()%(HEIGHT);
+    }
 }
\ No newline at end of file