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: Gameengine.cpp
- Revision:
- 20:78bd235f8caa
- Parent:
- 19:4789cb4ca550
diff -r 4789cb4ca550 -r 78bd235f8caa Gameengine.cpp
--- a/Gameengine.cpp Mon Apr 01 23:55:24 2019 +0000
+++ b/Gameengine.cpp Tue Apr 02 23:40:28 2019 +0000
@@ -30,10 +30,11 @@
_miner.miner_land(lcd);
lose_life(lcd);
game_over();
+ next_level(lcd);
}
void Gameengine::draw(N5110 &lcd)
-{
+{
if (_level_select == 1) {
_miner.miner_draw(lcd);
@@ -44,6 +45,12 @@
_l1.keys_collected();
_l1.spikes(lcd);
}
+ if(_level_select == 2) {
+
+ _miner.miner_draw(lcd);
+ lcd.drawLine(0,47,83,47,1);
+ printf("level 2 time = %f \n", t.read());
+ }
}
void Gameengine::lose_life(N5110 &lcd)
@@ -58,11 +65,19 @@
bool Gameengine::game_over()
{
- printf("The time taken was %f seconds\n", t.read());
- if(_lives == 0 || t.read() > 10){
+ if(_lives == 0 || t.read() > 60){
t.stop();
return true;
} else {
return false;
}
+}
+
+void Gameengine::next_level(N5110 &lcd)
+{
+ if(_l1.level1_exit(lcd) == true){
+ _level_select = 2;
+ _miner.miner_init(3,0);
+ t.reset();
+ }
}
\ No newline at end of file