ELEC2645 (2018/19) / Mbed 2 deprecated 2645_Project_SiutingWong201186503

Dependencies:   mbed

Revision:
9:f88f3f50bbee
Parent:
8:97576c8761a8
Child:
10:961bf7a76f45
--- a/main.cpp	Thu May 09 02:17:47 2019 +0000
+++ b/main.cpp	Thu May 09 02:56:02 2019 +0000
@@ -124,6 +124,22 @@
     { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0 },
     { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 },
 };
+
+const int intro3[12][16] = {
+    { 0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0 },
+    { 0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0 },
+    { 0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0 },
+    { 0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0 },
+    { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 },
+    { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 },
+    { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 },
+    { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0 },
+    { 0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0 },
+    { 0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0 },
+    { 0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0 },
+    { 0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0 },
+};
+
 ///////////// functions ////////////////
 int main() {
     while (1) {
@@ -183,7 +199,7 @@
     lcd.printString("of all life",9,4);
     lcd.printString("on Earth",18,5);
     lcd.refresh();
-    wait(3.0);
+    wait(2.0);
     lcd.printString("(Press start)",3,1);
     wait(1.0);
     while (pad.check_event(Gamepad::START_PRESSED) == false) {
@@ -223,15 +239,61 @@
         lcd.refresh();
         wait(0.5);
         lcd.clear();
-        lcd.printString("Use your",12,0);
-        lcd.printString("joystick to",15,1);
+        lcd.printString("Use your",18,0);
+        lcd.printString("joystick to",9,1);
         lcd.printString("send yourself",3,2);
         lcd.printString("to the right",6,3);
-        lcd.printString("Wormhole",6,4);
+        lcd.printString("Wormhole",18,4);
         lcd.drawSprite(0,40,8,84,(int *)intro2);
         lcd.refresh();
         wait(0.5);
     }
+    while (pad.check_event(Gamepad::START_PRESSED) == false) {
+        lcd.clear();
+        lcd.printString("try not to",12,0);
+        lcd.printString("interrupt",15,1);
+        lcd.printString("the time",0,2);
+        lcd.printString("line but",0,3);
+        lcd.printString("pass thro.",12,4);
+        lcd.printString("the gap",21,5);
+        lcd.drawSprite(54,16,12,16,(int *)intro3);
+        lcd.drawRect(77,0,2,18,FILL_BLACK);
+        lcd.drawRect(77,30,2,18,FILL_BLACK);
+        lcd.refresh();
+        wait(0.5);
+        lcd.clear();
+        lcd.printString("try not to",12,0);
+        lcd.printString("interrupt",15,1);
+        lcd.printString("the time",0,2);
+        lcd.printString("line but",0,3);
+        lcd.printString("pass thro.",12,4);
+        lcd.printString("the gap",21,5);
+        lcd.drawSprite(60,16,12,16,(int *)intro3);
+        lcd.drawRect(77,0,2,18,FILL_BLACK);
+        lcd.drawRect(77,30,2,18,FILL_BLACK);
+        lcd.refresh();
+        wait(0.5);
+    }
+    while (pad.check_event(Gamepad::START_PRESSED) == false) {
+        lcd.clear();
+        lcd.printString("retrieve 6",12,0);
+        lcd.printString("stones and",12,1);
+        lcd.printString("win the game",6,2);
+        lcd.printString("God speed",15,3);
+        lcd.printString("Avengers!",15,4);
+        lcd.refresh();
+        pad.leds_on();
+        wait(0.5);
+        lcd.clear();
+        lcd.printString("retrieve 6",12,0);
+        lcd.printString("stones and",12,1);
+        lcd.printString("win the game",6,2);
+        lcd.printString("God speed",15,3);
+        lcd.printString("Avengers!",15,4);
+        lcd.refresh();
+        pad.leds_off();
+        wait(0.5);
+    }
 }
 
 void render() {