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:
- 12:71683453f66a
- Parent:
- 10:adff3c804985
- Child:
- 17:5d8ff39a0e49
diff -r 5a6b9dffd78a -r 71683453f66a Score/Score.cpp --- a/Score/Score.cpp Sun Apr 14 15:56:58 2019 +0000 +++ b/Score/Score.cpp Mon Apr 15 01:38:53 2019 +0000 @@ -361,8 +361,10 @@ void Score::evolution_music(Gamepad &pad, N5110 &lcd, int cha, int year) { + int x = 84; + int y = 12; // bar 1 - draw(lcd, cha, year); + draw(lcd, cha, year, x, y); pad.tone(NOTE_G5,0.5/4); wait(0.5/4); pad.tone(NOTE_D5,0.5/4); @@ -380,7 +382,7 @@ lcd.refresh(); pad.tone(NOTE_G4,0.5/2); wait(0.25); - draw(lcd, cha, year); + draw(lcd, cha, year, x, y);; wait(0.25); pad.tone(NOTE_G4,0.5/2); wait(0.25); @@ -389,7 +391,7 @@ wait(0.25); pad.tone(NOTE_G4,0.5/2); wait(0.5); - draw(lcd, cha, year); + draw(lcd, cha, year, x, y); pad.tone(NOTE_G4,0.5/2); wait(0.25); lcd.clear(); @@ -397,7 +399,7 @@ wait(0.25); pad.tone(NOTE_G4,0.5/2); wait(0.25); - draw(lcd, cha, year); + draw(lcd, cha, year, x, y); wait(0.25); pad.tone(NOTE_G4,0.5/2); wait(0.5); @@ -406,44 +408,53 @@ pad.tone(NOTE_A4,0.5); wait(0.5); // bar 4 - draw(lcd, cha, year); + draw(lcd, cha, year, x, y); pad.tone(NOTE_G4,0.5/2); wait(0.5); lcd.clear(); lcd.refresh(); pad.tone(NOTE_G4,0.5/2); wait(0.5); - draw(lcd, cha, year); + draw(lcd, cha, year, x, y); pad.tone(NOTE_G4,0.5/2); wait(0.5); lcd.clear(); lcd.refresh(); pad.tone(NOTE_G4,0.5/2); wait(0.5); - draw(lcd, cha, year); + draw(lcd, cha, year, x, y); pad.tone(NOTE_G4,0.5/2); wait(0.25); lcd.clear(); lcd.refresh(); wait(0.25); - draw(lcd, cha, year); + draw(lcd, cha, year, x, y); pad.tone(NOTE_G4,0.5/2); wait(0.25); lcd.clear(); lcd.refresh(); wait(0.25); - draw(lcd, cha, year); + draw(lcd, cha, year, x, y); pad.tone(NOTE_G4,0.5/2); wait(0.25); lcd.clear(); lcd.refresh(); wait(0.25); - draw(lcd, cha, year); + draw(lcd, cha, year, x, y); pad.tone(NOTE_B4,0.5); wait(0.25); lcd.clear(); lcd.refresh(); wait(0.25); + year = year + 1; + if(year == 3){ + while(x > -170){ + draw(lcd, cha, year, x, y);; + x = x - 10; + wait(0.10); + } + } + year = year - 1; congrats(pad, lcd, cha, year); } @@ -474,13 +485,18 @@ wait(0.8); } -void Score::draw(N5110 &lcd, int cha, int year) +void Score::draw(N5110 &lcd, int cha, int year, int x, int y) { 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);} + 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);} lcd.refresh(); } @@ -489,10 +505,13 @@ lcd.clear(); if(year == 0 && cha == 1) {_s1.evo_1_cong(lcd);} else if(year == 0 && cha == 2) {_c1.evo_1_cong(lcd);} + else if(year == 0 && cha == 0) {_b1.evo_1_cong(lcd);} else if(year == 1 && cha == 1) {_s1.evo_2_cong(lcd);} else if(year == 1 && cha == 2) {_c1.evo_2_cong(lcd);} - else if (year == 2 && cha == 1) {_s1.evo_3_cong(lcd);} - else if (year == 2 && cha == 2) {_c1.evo_3_cong(lcd);} + else if(year == 1 && cha == 0) {_b1.evo_2_cong(lcd);} + else if(year == 2 && cha == 1) {_s1.evo_3_cong(lcd);} + else if(year == 2 && cha == 2) {_c1.evo_3_cong(lcd);} + else if(year == 2 && cha == 0) {_b1.evo_3_cong(lcd);} lcd.refresh(); }