Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: Asteroids/Asteroid.cpp
- 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);
}
}