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: main.cpp
- Revision:
- 19:4789cb4ca550
- Parent:
- 16:8384e9a480ef
- Child:
- 21:7a7a115d910d
--- a/main.cpp Mon Apr 01 21:51:08 2019 +0000 +++ b/main.cpp Mon Apr 01 23:55:24 2019 +0000 @@ -14,23 +14,20 @@ void init(); void start_screen(); void render(); +void restart(); int main() { init(); start_screen(); - - while (1) { - + contrast(); render(); - game.read_direction(pad); game.update(lcd, pad); + restart(); wait(0.1); - - } } @@ -50,7 +47,6 @@ void render() { game.draw(lcd); - } void contrast() @@ -59,20 +55,28 @@ float con = pot0.read(); lcd.setContrast(con); lcd.clear(); - } void start_screen() -{ - +{ lcd.printString("*MANIC MILNER!*",0,1); lcd.printString(" Press start! ",0,4); lcd.refresh(); - while ( pad.check_event(Gamepad::START_PRESSED) == false) { pad.leds_on(); wait(0.1); pad.leds_off(); wait(0.1); } +} + +void restart() +{ + if (game.game_over() == true) { + lcd.clear(); + lcd.printString("Game Over! ",16,1); + lcd.printString("Press reset to try again! ",0,3); + lcd.printString("try again! ",16,4); + wait(1); + } } \ No newline at end of file