Game codes for Pokemon Academy Yiu Fai Kwok - 201198802 I have read the University Regulations on Plagiarism and state that the work covered by this declaration is my own and does not contain any unacknowledged work from other sources.

Dependencies:   mbed FXOS8700CQ mbed-rtos

Revision:
31:0d2c19a285f6
Parent:
17:5d8ff39a0e49
Child:
32:58def659f463
diff -r 0ff3bede5307 -r 0d2c19a285f6 Score/Score.cpp
--- a/Score/Score.cpp	Mon May 06 20:37:23 2019 +0000
+++ b/Score/Score.cpp	Wed May 08 03:03:46 2019 +0000
@@ -494,12 +494,12 @@
 {
     // Draw sprite of selected character, call functions from Characters folder
     lcd.clear();
-    if(year == 1 && cha == 1) {_s1.evo_1_sprite(lcd);}
-    else if(year == 1 && cha == 2) {_c1.evo_1_sprite(lcd);}
-    else if(year == 1 && cha == 0) {_b1.evo_1_sprite(lcd);}
-    else if(year == 2 && cha == 1) {_s1.evo_2_sprite(lcd);}
-    else if(year == 2 && cha == 2) {_c1.evo_2_sprite(lcd);}
-    else if(year == 2 && cha == 0) {_b1.evo_2_sprite(lcd);}
+    if(year == 1 && cha == 1) {_s1.evo_1_sprite(lcd, 23, 9);}
+    else if(year == 1 && cha == 2) {_c1.evo_1_sprite(lcd, 23, 7);}
+    else if(year == 1 && cha == 0) {_b1.evo_1_sprite(lcd, 27, 14);}
+    else if(year == 2 && cha == 1) {_s1.evo_2_sprite(lcd, 20, 2);}
+    else if(year == 2 && cha == 2) {_c1.evo_2_sprite(lcd, 17, 2);}
+    else if(year == 2 && cha == 0) {_b1.evo_2_sprite(lcd, 14, 1);}
     else if(year == 3 && cha == 1) {_s1.evo_3_sprite(lcd, x, y);}
     else if(year == 3 && cha == 2) {_c1.evo_3_sprite(lcd, x, y);}
     else if(year == 3 && cha == 0) {_b1.evo_3_sprite(lcd, x, y);}
@@ -1175,4 +1175,286 @@
         pad.tone(NOTE_A5,0.33*1.5);
         wait(0.33*1.5);
     }
+}
+
+void Score::draw_grad(N5110 &lcd, int cha, int year, int x)
+{
+    // Draw sprite of selected character in graduation, call functions from Characters folder
+    lcd.clear();
+    if(year == 1 && cha == 1) {_s1.evo_1_sprite(lcd, x, 9);}
+    else if(year == 1 && cha == 2) {_c1.evo_1_sprite(lcd, x, 7);}
+    else if(year == 1 && cha == 0) {_b1.evo_1_sprite(lcd, x, 14);}
+    else if(year == 2 && cha == 1) {_s1.evo_2_sprite(lcd, x, 2);}
+    else if(year == 2 && cha == 2) {_c1.evo_2_sprite(lcd, x, 2);}
+    else if(year == 2 && cha == 0) {_b1.evo_2_sprite(lcd, x, 1);}
+    else if(year == 3 && cha == 1) {_s1.evo_3_cong(lcd);}
+    else if(year == 3 && cha == 2) {_c1.evo_3_cong(lcd);}
+    else if(year == 3 && cha == 0) {_b1.evo_3_cong(lcd);}
+    lcd.refresh();
+}
+
+void Score::graduation(Gamepad &pad, N5110 &lcd, int cha)
+{
+    // bar 1
+    draw_grad(lcd, cha, 1, 84);
+    pad.tone(NOTE_G4,0.46/4);
+    wait(0.46/4);
+    pad.tone(NOTE_A4,0.46/4);
+    wait(0.46/4);
+    pad.tone(NOTE_B4,0.46*1.5);
+    wait(0.46*1.5);
+    pad.tone(NOTE_A4,0.46/4);
+    wait(0.46/4);
+    pad.tone(NOTE_B4,0.46/4);
+    wait(0.46/4);
+    // bar 2
+    draw_grad(lcd, cha, 1, 84);
+    pad.tone(NOTE_C5,0.46/2);
+    wait(0.46/2);
+    pad.tone(NOTE_G3,0.46);
+    wait(0.46/2);
+    draw_grad(lcd, cha, 1, 74);
+    wait(0.46/2);
+    draw_grad(lcd, cha, 1, 64);
+    pad.tone(NOTE_G3,0.46/4);
+    wait(0.46/4);
+    pad.tone(NOTE_G3,0.46/4);
+    wait(0.46/4);
+    draw_grad(lcd, cha, 1, 54);
+    pad.tone(NOTE_G3,0.46/2);
+    wait(0.46/2);
+    draw_grad(lcd, cha, 1, 44);
+    pad.tone(NOTE_G3,0.46/2);
+    wait(0.46/2);
+    draw_grad(lcd, cha, 1, 34);
+    pad.tone(NOTE_G3,0.46);
+    wait(0.46/2);
+    draw_grad(lcd, cha, 1, 24);
+    wait(0.46/2);
+    // bar 3
+    pad.tone(NOTE_G3,0.46/2);
+    wait(0.46/2);
+    pad.tone(NOTE_G3,0.46);
+    wait(0.46);
+    pad.tone(NOTE_G3,0.46/4);
+    wait(0.46/4);
+    pad.tone(NOTE_G3,0.46/4);
+    wait(0.46/4);
+    pad.tone(NOTE_G3,0.46/2);
+    wait(0.46/2);
+    pad.tone(NOTE_G3,0.46/2);
+    wait(0.46/2);
+    pad.tone(NOTE_G3,0.46);
+    wait(0.46);
+    // bar 4
+    pad.tone(NOTE_C5,0.46*1.5);
+    wait(0.46*1.5);
+    pad.tone(NOTE_G4,0.46/4);
+    wait(0.46/4);
+    pad.tone(NOTE_C5,0.46/4);
+    wait(0.46/4);
+    pad.tone(NOTE_E5,0.46*2);
+    wait(0.46*2);
+    // bar 5
+    wait(0.46/2);
+    pad.tone(NOTE_G4,0.46/2);
+    wait(0.46/2);
+    pad.tone(NOTE_C5,0.46/2);
+    wait(0.46/2);
+    pad.tone(NOTE_G5,0.46/2);
+    wait(0.46/2);
+    pad.tone(NOTE_F5,0.46/2);
+    wait(0.46/2);
+    pad.tone(NOTE_E5,0.46/2);
+    wait(0.46/2);
+    pad.tone(NOTE_D5,0.46/2);
+    wait(0.46/2);
+    pad.tone(NOTE_C5,0.46/2);
+    wait(0.46/2);
+    // bar 6
+    draw_grad(lcd, cha, 1, 14);
+    pad.tone(NOTE_D5,0.46*2);
+    wait(0.46/2);
+    draw_grad(lcd, cha, 1, 4);
+    wait(0.46/2);
+    draw_grad(lcd, cha, 1, -6);
+    wait(0.46/2);
+    draw_grad(lcd, cha, 1, -16);
+    wait(0.46/2);
+    draw_grad(lcd, cha, 1, -26);
+    pad.tone(NOTE_F5,0.46*2);
+    wait(0.46/2);
+    draw_grad(lcd, cha, 1, -36);
+    wait(0.46/2);
+    draw_grad(lcd, cha, 1, -46);
+    wait(0.46/2);
+    draw_grad(lcd, cha, 1, -56);
+    wait(0.46/2);
+    // bar 7
+    draw_grad(lcd, cha, 2, 84);
+    pad.tone(NOTE_A4,0.46*2);
+    wait(0.46/2);
+    draw_grad(lcd, cha, 2, 74);
+    wait(0.46/2);
+    draw_grad(lcd, cha, 2, 64);
+    wait(0.46/2);
+    draw_grad(lcd, cha, 2, 54);
+    wait(0.46/2);
+    draw_grad(lcd, cha, 2, 44);
+    pad.tone(NOTE_B4,0.46*2);
+    wait(0.46/2);
+    draw_grad(lcd, cha, 2, 34);
+    wait(0.46/2);
+    draw_grad(lcd, cha, 2, 24);
+    wait(0.46/2);
+    draw_grad(lcd, cha, 2, 17);
+    wait(0.46/2);
+    // bar 8
+    pad.tone(NOTE_C5,0.46*1.5);
+    wait(0.46*1.5);
+    pad.tone(NOTE_G4,0.46/4);
+    wait(0.46/4);
+    pad.tone(NOTE_C5,0.46/4);
+    wait(0.46/4);
+    pad.tone(NOTE_E5,0.46*2);
+    wait(0.46*2);
+    // bar 9
+    wait(0.46/2);
+    pad.tone(NOTE_G4,0.46/2);
+    wait(0.46/2);
+    pad.tone(NOTE_C5,0.46/2);
+    wait(0.46/2);
+    pad.tone(NOTE_G5,0.46/2);
+    wait(0.46/2);
+    pad.tone(NOTE_F5,0.46/2);
+    wait(0.46/2);
+    pad.tone(NOTE_E5,0.46/2);
+    wait(0.46/2);
+    pad.tone(NOTE_D5,0.46/2);
+    wait(0.46/2);
+    pad.tone(NOTE_C5,0.46/2);
+    wait(0.46/2);
+    // bar 10
+    pad.tone(NOTE_D5,0.46*2);
+    wait(0.46*2);
+    pad.tone(NOTE_F5,0.46*2);
+    wait(0.46*2);
+    // bar 11
+    pad.tone(NOTE_B4,0.46*2);
+    wait(0.46*2);
+    pad.tone(NOTE_D5,0.46*1.5);
+    wait(0.46*1.5);
+    pad.tone(NOTE_C5,0.46/4);
+    wait(0.46/4);
+    pad.tone(NOTE_D5,0.46/4);
+    wait(0.46/4);
+    // bar 12
+    pad.tone(NOTE_E5,0.46/2);
+    wait(0.46/2);
+    draw_grad(lcd, cha, 2, 7);
+    pad.tone(NOTE_D5,0.46/2);
+    wait(0.46/2);
+    draw_grad(lcd, cha, 2, -3);
+    pad.tone(NOTE_E5,0.46/2);
+    wait(0.46/2);
+    draw_grad(lcd, cha, 2, -13);
+    pad.tone(NOTE_C5,0.46*2);
+    wait(0.46/2);
+    draw_grad(lcd, cha, 2, -23);
+    wait(0.46/2);
+    draw_grad(lcd, cha, 2, -33);
+    wait(0.46/2);
+    draw_grad(lcd, cha, 2, -43);
+    wait(0.46/2);
+    draw_grad(lcd, cha, 2, -53);
+    pad.tone(NOTE_B4,0.46/4);
+    wait(0.46/4);
+    pad.tone(NOTE_C5,0.46/4);
+    wait(0.46/4);
+    draw_grad(lcd, cha, 2, -63);
+    // bar 13
+    pad.tone(NOTE_D5,0.46/2);
+    wait(0.46/2);
+    pad.tone(NOTE_G4,0.46);
+    wait(0.46);
+    pad.tone(NOTE_G5,0.46*2);
+    wait(0.46*2);
+    pad.tone(NOTE_F5,0.46/4);
+    wait(0.46/4);
+    pad.tone(NOTE_E5,0.46/4);
+    wait(0.46/4);
+    // bar 14
+    pad.tone(NOTE_F5,0.46*2/3);
+    wait(0.46*2/3);
+    pad.tone(NOTE_E5,0.46*2/3);
+    wait(0.46*2/3);
+    pad.tone(NOTE_C5,0.46*2/3);
+    wait(0.46*2/3);
+    pad.tone(NOTE_C5,0.46*2);
+    wait(0.46*2);
+    // bar 15
+    pad.tone(NOTE_A4,0.46*2);
+    wait(0.46*2);
+    pad.tone(NOTE_B4,0.46*2);
+    wait(0.46*2);
+    // bar 16
+    draw_grad(lcd, cha, 3, 0);
+    pad.tone(NOTE_E5,0.46/2);
+    wait(0.46/2);
+    pad.tone(NOTE_D5,0.46/2);
+    wait(0.46/2);
+    pad.tone(NOTE_E5,0.46/2);
+    wait(0.46/2);
+    pad.tone(NOTE_C5,0.46*2);
+    wait(0.46*2);
+    pad.tone(NOTE_B4,0.46/4);
+    wait(0.46/4);
+    pad.tone(NOTE_C5,0.46/4);
+    wait(0.46/4);
+    // bar 17
+    pad.tone(NOTE_D5,0.46/2);
+    wait(0.46/2);
+    pad.tone(NOTE_G4,0.46);
+    wait(0.46);
+    pad.tone(NOTE_G5,0.46*2);
+    wait(0.46*2);
+    pad.tone(NOTE_F5,0.46/4);
+    wait(0.46/4);
+    pad.tone(NOTE_E5,0.46/4);
+    wait(0.46/4);
+    // bar 18
+    pad.tone(NOTE_F5,0.46*2/3);
+    wait(0.46*2/3);
+    pad.tone(NOTE_E5,0.46*2/3);
+    wait(0.46*2/3);
+    pad.tone(NOTE_C5,0.46*2/3);
+    wait(0.46*2/3);
+    pad.tone(NOTE_C5,0.46*2);
+    wait(0.46*2);
+    // bar 19
+    pad.tone(NOTE_A4,0.46*1.5);
+    wait(0.46*1.5);
+    pad.tone(NOTE_G4,0.46/4);
+    wait(0.46/4);
+    pad.tone(NOTE_A4,0.46/4);
+    wait(0.46/4);
+    pad.tone(NOTE_B4,0.46);
+    wait(0.46);
+    pad.tone(NOTE_D5,0.46);
+    wait(0.46);
+    // bar 20
+    pad.tone(NOTE_C5,0.46/2);
+    wait(0.46/2);
+    pad.tone(NOTE_C5,0.46);
+    wait(0.46);
+    pad.tone(NOTE_C5,0.46/4);
+    wait(0.46/4);
+    pad.tone(NOTE_C5,0.46/4);
+    wait(0.46/4);
+    pad.tone(NOTE_C5,0.46/2);
+    wait(0.46/2);
+    pad.tone(NOTE_C5,0.46/2);
+    wait(0.46/2);
+    pad.tone(NOTE_C5,0.46);
+    wait(0.46);
 }
\ No newline at end of file