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: SpaceEngine/SpaceEngine.cpp
- Revision:
- 137:fe80c0f2da9d
- Parent:
- 136:58f393968aa3
- Child:
- 145:e060e890c725
--- a/SpaceEngine/SpaceEngine.cpp Wed May 08 19:10:28 2019 +0000
+++ b/SpaceEngine/SpaceEngine.cpp Thu May 09 04:45:37 2019 +0000
@@ -36,12 +36,9 @@
}
-
-
void SpaceEngine::draw(N5110 &lcd)
{
_bullet.draw(lcd);
- //if(!_killed){_alien.draw(lcd);}
if (_alien.isAlive() == true) {
_alien.draw(lcd);
@@ -56,35 +53,33 @@
char kills[14];
sprintf(kills,"%2d",_alien_killed);
lcd.printString(kills,70,0);
-
+
}
-
-
-
-
void SpaceEngine::update(Gamepad &pad)
{
_bullet.update(_d,_mag);
_alien.update(_d,_mag);
_spaceship.update(_d,_mag);
- _check_space_collision(pad);
+ check_space_collision(pad);
_y_alien = _alien.get_pos_y();
_x_alien = _alien.get_pos_x();
_y_bullet = _bullet.get_pos_y();
_x_bullet = _bullet.get_pos_x();
if(_d==E) {
_fired_bullet=1;
-
- _bullet.set_pos(_spaceship.get_pos_x()+33, _spaceship.get_pos_y());
+ }
+ _bullet.set_pos(_spaceship.get_pos_x()+33, _spaceship.get_pos_y());
}
+
+
+
+void SpaceEngine::check_space_collision(Gamepad &pad) {
-void SpaceEngine::_check_space_collision(Gamepad &pad) {
-
if(_x_bullet >= 65 && _x_bullet <= 68 && _y_bullet >= _y_alien-5 && _y_bullet <= _y_alien+15) {
_alien.setAlive(false);
_alien_killed++;
}
-
+
}