Simple fish eat program

Dependencies:   mbed mbed-rtos N5110 ShiftReg Tone

Revision:
10:e221bd1ce3ec
Parent:
8:fe51fbf81dee
Child:
11:7c1e2a9303d3
--- a/classes/FishEngine.cpp	Tue Apr 20 15:08:37 2021 +0000
+++ b/classes/FishEngine.cpp	Tue Apr 20 15:35:00 2021 +0000
@@ -5,6 +5,7 @@
 #define CENTRE 2
 
 //objects
+Game game;
 Settings settings;
 Graphics graphics;
 
@@ -29,6 +30,16 @@
     lcd.refresh();
 }
 
+void FishEngine::gamePlay(N5110 &lcd, Tone &dac, Joystick &joystick){
+    game.init(lcd, 20, 20, 1);
+    
+    do{
+        DIRECTION direction = {joystick.get_direction()};
+        game.gamePlay(lcd, direction);
+        
+    }while(game.Lives() != 0);
+}
+
 void FishEngine::Instructions(N5110 &lcd){
     do{
         lcd.clear();
@@ -115,6 +126,8 @@
             //case for new game
             case 0:
                 if(settings.buttonA_state(ButtonA)){
+                    graphics.screenFlash(lcd);
+                    gamePlay(lcd, dac, joystick);
                 }
                 switch(direction) {
                     case UP: