submit

Dependencies:   mbed Gamepad N5110

Revision:
4:323f42022d87
Parent:
3:1358cbb05ad3
Child:
5:82094591b4b4
--- a/main.cpp	Sun Apr 14 05:45:31 2019 +0000
+++ b/main.cpp	Sun Apr 14 06:47:12 2019 +0000
@@ -14,7 +14,7 @@
 ///////////// prototypes ///////////////
 void init();
 void run();
-
+void over();
 ///////////// functions ////////////////
 int main()
 {
@@ -23,12 +23,12 @@
     init(); 
     engine.welcome(pad,lcd);  // show welcome display, waiting for the user to start
     
-     // game loop - read input, update the game state and render the display
+    // game loop - read input, update the game state and render the display
     while (snake.over == 0) {
     run();
     wait(1.0f/fps);  // and wait for one frame period
     }
-    engine.gameover(pad,lcd);
+    over();
 
  
 }
@@ -59,5 +59,9 @@
      
 }
 
+void over()
+{
+    int s = snake.get_score();
+    engine.gameover(pad,lcd,s);
 
-
+}
\ No newline at end of file