ELEC2645 (2017/18) / Mbed 2 deprecated fy15raf

Dependencies:   mbed

Revision:
8:13cef7cb872e
Parent:
6:7b733b2a6cf6
Child:
11:cb48d596aa3e
--- a/Asteroids/Asteroid.cpp	Tue Apr 24 10:17:39 2018 +0000
+++ b/Asteroids/Asteroid.cpp	Tue Apr 24 11:17:43 2018 +0000
@@ -10,13 +10,13 @@
 
 }
 
-void Asteroid::init(int speed)
+void Asteroid::init(float speed)
 {
     _size = 5;
     _x = WIDTH - _size;
 
    // srand(time(NULL));
-    _y1 = 22; //rand()%(HEIGHT); // random initial position on y-axis.
+    _y1 = rand()%(HEIGHT); // random initial position on y-axis.
 
     _velocity.x = speed;
 }
@@ -43,7 +43,7 @@
         _x -= _velocity.x;
     } else {
         _x = WIDTH - _size; //start from the begining again
-        _y1= 22; //rand()%(HEIGHT);
+        _y1= rand()%(HEIGHT);
     }
 }