submit

Dependencies:   mbed Gamepad N5110

Revision:
14:e1f7b4be1cf2
Parent:
13:32772a08841e
Child:
15:4123abb17291
--- a/main.cpp	Mon Apr 22 06:43:21 2019 +0000
+++ b/main.cpp	Mon Apr 22 07:22:56 2019 +0000
@@ -23,11 +23,13 @@
     int fps = 8;  // frames per second
     snake.hscore = 0;
     lcd.init();
+    pad.tone(1500.0,0.5);
     while(1){    
       init(); 
       engine.welcome(pad,lcd);  // show welcome display, waiting for the user to start
       engine.menu(pad,lcd);  // show the select display, waiting for the user to select
     // game loop - read input, update the game state and render the display
+    if(engine.game == 0){
       while (snake.over == 0) {
         run(); // run the game
         while (pad.check_event(Gamepad::START_PRESSED) == true){
@@ -36,9 +38,9 @@
         wait(engine.p/fps);  // and wait for one frame period
       }
      over();  // show gameover display, waiting for the user to restart
-     //if(pad.check_event(Gamepad::R_PRESSED) == true){
-        // finger.run(lcd,pad);
-        // }
+     }else if(engine.game == 1){
+         finger.run(lcd,pad);
+         }
     }
 }
 
@@ -66,7 +68,6 @@
     engine.init();
     finger.init();
     lcd.clear();
-
 }
 
 void over()