ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el19tb

Dependencies:   mbed

Revision:
56:2797166656e0
Parent:
55:b17b9931c010
Child:
61:3714af9caab6
--- a/Frogger/Frogger.cpp	Tue May 26 19:54:05 2020 +0000
+++ b/Frogger/Frogger.cpp	Tue May 26 20:51:56 2020 +0000
@@ -134,6 +134,24 @@
     } 
 }
 
+void Frogger::displayIntro()
+{
+    graphics.introOne();
+    wait_ms(10);
+    graphics.refresh(); // refresh the lcd screen
+
+    graphics.refresh(); // refresh the lcd screen
+    graphics.clear();
+    graphics.introTwo();
+    wait_ms(3000);
+    graphics.refresh(); // refresh the lcd screen
+
+    graphics.refresh(); // refresh the lcd screen
+    graphics.clear();
+    wait_ms(5000);
+    graphics.refresh(); // refresh the lcd screen 
+}
+
 void Frogger::displayLevelIntro()
 {
     graphics.clear();
@@ -187,12 +205,22 @@
     process_input(); // user controls the frog object
        
     actOnFrogBonus();
+    
+    checkFrogInDeathZone();
         
     graphics.showFrog(frog->x, frog->y, frog->width, frog->height, state_frog); // display current position of frog 
     
     graphics.drawVoidBackGround();
 }
 
+void Frogger::checkFrogInDeathZone()
+{
+    if(frog->x < 35 || frog->x > 55)
+    {
+        frog->reset();
+    }
+}
+
 void Frogger::checkProgression()
 { 
     if((frog->y == 48 - 4*11 || frog->y == 48 - 4*10)){