
Kaif Kutchwala 201267448 ELEC2645 Project
Dependencies: mbed
Diff: main.cpp
- Revision:
- 22:76bb0f52be8b
- Parent:
- 21:d5b1160f349f
- Child:
- 23:ad9ac069e751
diff -r d5b1160f349f -r 76bb0f52be8b main.cpp --- a/main.cpp Mon May 25 00:55:38 2020 +0000 +++ b/main.cpp Mon May 25 13:08:00 2020 +0000 @@ -56,11 +56,12 @@ void init() { run_all_tests(); lcd.init(); + pad.init(); lcd.setContrast(0.5); - pad.init(); lcd.backLightOn(); splash.displayInfo(); splash.playIntro(); + game.init(); } void display_menu() { splash.drawLogo(13, 0); @@ -85,7 +86,6 @@ } void game_loop() { wait(0.2); //debounce - game.init(); game.play(); lcd.clear(); lcd.printString("GAME OVER",15,2); @@ -96,11 +96,8 @@ } void how_to() { pad.leds(0.0); - if(pad.get_direction() == N) { - page--; - } else if (pad.get_direction() == S || page == 3 || page == 4) { - page++; - } + if(pad.get_direction() == N) { page--; } + else if (pad.get_direction() == S || page == 3 || page == 4) { page++; } if(page > 7) {page = 7;} if(page < 1) {page = 1;} instruction.set_page(page);