Kaif Kutchwala 201267448 ELEC2645 Project

Dependencies:   mbed

Revision:
29:532e5c371be4
Parent:
28:215e8327d4e6
Child:
30:abe30c123470
--- a/main.cpp	Tue May 26 14:45:02 2020 +0000
+++ b/main.cpp	Tue May 26 15:21:51 2020 +0000
@@ -93,14 +93,22 @@
     lcd.clear();
 }
 void game_loop() {
+    char buffer_score[14];
+    char buffer_high_score[14];
     game.init(); //initialise
     wait(0.2); //debounce
     game.play(); //play game
+/////////////////// game has now ended //////////////////////////////////////
     lcd.clear(); //clear screen once game is over and display apt message
+    // store player score and top score in buffer
+    sprintf(buffer_score, "Your Score: %d", game.get_score());
+    sprintf(buffer_high_score, "Top Score: %d", game.get_highscore());
     lcd.printString("GAME OVER", 15, 2);
+    lcd.printString(buffer_score,0,3);
+    lcd.printString(buffer_high_score,0,4);
     lcd.refresh();
     game.playGoalSound(3); // game over sound effect
-    wait(2);
+    wait(3);
     pad.reset_buttons(); //to ensure no accidental selection on menu
 }
 void how_to() {