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
Diff: Score/Score.cpp
- Revision:
- 17:5d8ff39a0e49
- Parent:
- 12:71683453f66a
- Child:
- 31:0d2c19a285f6
diff -r 4e49f5cb972e -r 5d8ff39a0e49 Score/Score.cpp --- a/Score/Score.cpp Sat Apr 20 15:20:43 2019 +0000 +++ b/Score/Score.cpp Sun Apr 21 11:02:28 2019 +0000 @@ -21,6 +21,7 @@ wait(0.1); pad.tone(NOTE_FS4,0.1); wait(0.1); + // Note: to break out of the looping of the title music if(pad.check_event(Gamepad::START_PRESSED) == true){break;} pad.tone(NOTE_G4,0.4); wait(0.4); @@ -361,6 +362,7 @@ void Score::evolution_music(Gamepad &pad, N5110 &lcd, int cha, int year) { + //Initiate position for name titles int x = 84; int y = 12; // bar 1 @@ -446,6 +448,7 @@ lcd.clear(); lcd.refresh(); wait(0.25); + // Define motion of name title for final evolution, activate when year = year + 1 = 3. Update lcd screen at 10 frames per sec. year = year + 1; if(year == 3){ while(x > -170){ @@ -454,12 +457,14 @@ wait(0.10); } } + // Decrease parameter (year) to draw the corresponding evolution sprite year = year - 1; congrats(pad, lcd, cha, year); } void Score::congrats(Gamepad &pad, N5110 &lcd, int cha, int year) { + // Draw the corresponding evolution depending on the year (year) and character selected (cha) draw_cong(lcd, cha, year); // bar 1 pad.tone(NOTE_A5,0.4); @@ -487,6 +492,7 @@ void Score::draw(N5110 &lcd, int cha, int year, int x, int y) { + // 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);} @@ -502,6 +508,7 @@ void Score::draw_cong(N5110 &lcd, int cha, int year) { + // Draw sprite of selected character after evolution, call functions from Characters folder lcd.clear(); if(year == 0 && cha == 1) {_s1.evo_1_cong(lcd);} else if(year == 0 && cha == 2) {_c1.evo_1_cong(lcd);} @@ -770,6 +777,8 @@ wait(0.33/2); pad.tone(NOTE_CS5,0.33*1.5); wait(0.33*1.5); + + // Loop while state is true while(state){ // bar 8 pad.tone(NOTE_DS5,0.33);