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:
- 11:cb48d596aa3e
- Parent:
- 8:13cef7cb872e
- Child:
- 12:4d7f1349d796
--- a/Asteroids/Asteroid.cpp Thu May 03 12:07:54 2018 +0000
+++ b/Asteroids/Asteroid.cpp Thu May 03 22:34:03 2018 +0000
@@ -17,24 +17,25 @@
// srand(time(NULL));
_y1 = rand()%(HEIGHT); // random initial position on y-axis.
-
+//_y1 =22;
_velocity.x = speed;
}
void Asteroid::draw(N5110 &lcd)
{
- int sprite[6][10] = {
+ int sprite[6][11] = {
- { 0,0,0,0,1,1,0,1,0,0, },
- { 0,0,1,1,0,0,1,0,0,0, },
- { 0,1,1,1,1,0,1,1,1,0, },
- { 0,1,1,1,1,0,1,1,1,1, },
- { 0,0,1,1,0,0,1,0,0,0, },
- { 0,0,0,0,1,1,0,1,0,0, },
+
+ { 0,0,1,1,0,1,0,0,1,1,0, },
+ { 0,1,1,1,1,1,1,0,0,0,0, },
+ { 1,1,0,1,1,1,0,1,0,0,0, },
+ { 1,1,1,1,1,1,1,1,0,1,1, },
+ { 0,1,1,1,0,1,1,0,0,0,0, },
+ { 0,0,0,1,1,1,0,0,1,1,0, },
};
- lcd.drawSprite(_x,_y1,6,10,(int *)sprite);
+ lcd.drawSprite(_x,_y1,6,11,(int *)sprite);
}
void Asteroid::update()
@@ -44,6 +45,7 @@
} else {
_x = WIDTH - _size; //start from the begining again
_y1= rand()%(HEIGHT);
+ //_y1 =22;
}
}