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

Score/Score.cpp

Committer:
yfkwok
Date:
2019-04-15
Revision:
12:71683453f66a
Parent:
10:adff3c804985
Child:
17:5d8ff39a0e49

File content as of revision 12:71683453f66a:

#include "Score.h"

Score::Score()
{

}

Score::~Score()
{

}

void Score::title_music(Gamepad &pad)
{
    while(1){
        pad.tone(NOTE_G3,0.1);
        wait(0.1);
        pad.tone(NOTE_B3,0.1);
        wait(0.1);
        pad.tone(NOTE_D4,0.1);
        wait(0.1);
        pad.tone(NOTE_FS4,0.1);
        wait(0.1);
        if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
        pad.tone(NOTE_G4,0.4);
        wait(0.4);
        if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
        pad.tone(NOTE_G4,0.4);
        wait(0.4);
        if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
        wait(0.2);
        pad.tone(NOTE_G4,0.1);
        wait(0.1);
        pad.tone(NOTE_G4,0.1);
        wait(0.1);
        if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
        pad.tone(NOTE_G4,0.4);
        wait(0.4);
        if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
        pad.tone(NOTE_G4,0.4);
        wait(0.4);
        if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
        pad.tone(NOTE_G4,0.4);
        wait(0.4);
        if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
        pad.tone(NOTE_F4,0.4/3);
        wait(0.4/3);
        pad.tone(NOTE_F4,0.4/3);
        wait(0.4/3);
        pad.tone(NOTE_F4,0.4/3);
        wait(0.4/3);
        if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
        pad.tone(NOTE_F4,0.4/3);
        wait(0.4/3);
        pad.tone(NOTE_F4,0.4/3);
        wait(0.4/3);
        pad.tone(NOTE_FS4,0.4/3);
        wait(0.4/3);
        if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
        
        while(1){
            //bar 4
            pad.tone(NOTE_G4,0.6);
            wait(0.6);
            pad.tone(NOTE_B4,0.2);
            wait(0.2);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_D5,0.8);
            wait(0.8);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_C4,0.6);
            wait(0.6);
            pad.tone(NOTE_F4,0.2);
            wait(0.2);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_F5,0.6);
            wait(0.6);
            pad.tone(NOTE_E5,0.1);
            wait(0.1);
            pad.tone(NOTE_DS5,0.1);
            wait(0.1);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            //bar 6
            pad.tone(NOTE_D5,0.8);
            wait(0.8);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_F4,0.6);
            wait(0.6);
            pad.tone(NOTE_E4,0.1);
            wait(0.1);
            pad.tone(NOTE_DS4,0.1);
            wait(0.1);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_D4,0.8);
            wait(0.8);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_C4,0.8/3);
            wait(0.8/3);
            pad.tone(NOTE_B3,0.8/3);
            wait(0.8/3);
            pad.tone(NOTE_C4,0.8/3);
            wait(0.8/3);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_G4,0.6);
            wait(0.6);
            pad.tone(NOTE_B4,0.2);
            wait(0.2);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_D5,0.8);
            wait(0.8);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_C4,0.8);
            wait(0.8);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_C5,0.8/3);
            wait(0.8/3);
            pad.tone(NOTE_B4,0.8/3);
            wait(0.8/3);
            pad.tone(NOTE_C5,0.8/3);
            wait(0.8/3);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_D5,0.8);
            wait(0.8);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_F4,0.8/3);
            wait(0.8/3);
            pad.tone(NOTE_E4,0.8/3);
            wait(0.8/3);
            pad.tone(NOTE_C4,0.8/3);
            wait(0.8/3);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_D4,1.0);
            wait(1.0);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_B3,0.2);
            wait(0.2);
            pad.tone(NOTE_C4,0.2);
            wait(0.2);
            pad.tone(NOTE_D4,0.2);
            wait(0.2);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            //bar 12
            pad.tone(NOTE_G4,0.6);
            wait(0.6);
            pad.tone(NOTE_B4,0.2);
            wait(0.2);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_D5,0.8);
            wait(0.8);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_C4,0.6);
            wait(0.6);
            pad.tone(NOTE_F4,0.2);
            wait(0.2);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_F5,0.6);
            wait(0.6);
            pad.tone(NOTE_E5,0.1);
            wait(0.1);
            pad.tone(NOTE_DS5,0.1);
            wait(0.1);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_D5,0.8);
            wait(0.8);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_F4,0.6);
            wait(0.6);
            pad.tone(NOTE_E4,0.1);
            wait(0.1);
            pad.tone(NOTE_DS4,0.1);
            wait(0.1);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_D4,0.8);
            wait(0.8);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_C4,0.8/3);
            wait(0.8/3);
            pad.tone(NOTE_B3,0.8/3);
            wait(0.8/3);
            pad.tone(NOTE_C4,0.8/3);
            wait(0.8/3);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_G4,0.6);
            wait(0.6);
            pad.tone(NOTE_B4,0.2);
            wait(0.2);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_D5,0.8);
            wait(0.8);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            //bar 17
            pad.tone(NOTE_C4,0.6);
            wait(0.6);
            pad.tone(NOTE_C4,0.2);
            wait(0.2);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_F5,0.8/3);
            wait(0.8/3);
            pad.tone(NOTE_E5,0.8/3);
            wait(0.8/3);
            pad.tone(NOTE_F5,0.8/3);
            wait(0.8/3);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_G5,0.6);
            wait(0.6);
            pad.tone(NOTE_AS5,0.2);
            wait(0.2);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_G5,0.8);
            wait(0.8);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_G5,0.6);
            wait(0.6);
            pad.tone(NOTE_A4,0.2);
            wait(0.2);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_A5,0.8);
            wait(0.8);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_AS5,0.6);
            wait(0.6);
            pad.tone(NOTE_F5,0.2);
            wait(0.2);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_F5,0.8);
            wait(0.8);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_F5,0.8);
            wait(0.8);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_AS5,0.4);
            wait(0.4);
            pad.tone(NOTE_B5,0.4);
            wait(0.4);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_C6,0.6);
            wait(0.6);
            pad.tone(NOTE_G5,0.2);
            wait(0.2);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_G5,0.8);
            wait(0.8);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            //bar 23
            pad.tone(NOTE_G5,0.8);
            wait(0.8);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_C6,0.4);
            wait(0.4);
            pad.tone(NOTE_CS6,0.4);
            wait(0.4);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_D6,0.3);
            wait(0.3);
            pad.tone(NOTE_D5,0.1);
            wait(0.1);
            wait(0.3);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_D5,0.1);
            wait(0.1);
            wait(0.3);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_D5,0.1);
            wait(0.1);
            wait(0.3);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_D5,0.1);
            wait(0.1);
            wait(0.3);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_D5,0.1);
            wait(0.1);
            wait(0.3);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_D5,0.1);
            wait(0.1);
            pad.tone(NOTE_C6,0.8/3);
            wait(0.8/3);
            pad.tone(NOTE_C6,0.8/3);
            wait(0.8/3);
            pad.tone(NOTE_CS6,0.8/3);
            wait(0.8/3);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_D6,0.3);
            wait(0.3);
            pad.tone(NOTE_D5,0.1);
            wait(0.1);
            wait(0.3);
            pad.tone(NOTE_D5,0.1);
            wait(0.1);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            wait(0.3);
            pad.tone(NOTE_D5,0.1);
            wait(0.1);
            wait(0.3);
            pad.tone(NOTE_D5,0.1);
            wait(0.1);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            wait(0.3);
            pad.tone(NOTE_D5,0.1);
            wait(0.1);
            wait(0.3);
            pad.tone(NOTE_D5,0.1);
            wait(0.1);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
            pad.tone(NOTE_C6,0.8/3);
            wait(0.8/3);
            pad.tone(NOTE_C6,0.8/3);
            wait(0.8/3);
            pad.tone(NOTE_B5,0.8/3);
            wait(0.8/3);
            if(pad.check_event(Gamepad::START_PRESSED) == true){break;}
        }
        
        break;
    }
}

void Score::level_up(Gamepad &pad)
{
    pad.tone(NOTE_E5,0.12);
    wait(0.15);
    pad.tone(NOTE_E5,0.12);
    wait(0.15);
    pad.tone(NOTE_E5,0.12);
    wait(0.15);
    pad.tone(NOTE_B5,0.45);
    wait(0.45);
}

void Score::congrats(Gamepad &pad)
{
    pad.tone(NOTE_A5,0.35);
    wait(0.35);
    pad.tone(NOTE_F5,0.35);
    wait(0.35);
    pad.tone(NOTE_C5,0.7);
    wait(0.7);
    pad.tone(NOTE_AS5,0.35/3);
    wait(0.35/3);
    pad.tone(NOTE_AS5,0.35/3);
    wait(0.35/3);
    pad.tone(NOTE_AS5,0.35/3);
    wait(0.35/3);
    pad.tone(NOTE_G5,0.35/3);
    wait(0.35/3);
    pad.tone(NOTE_G5,0.35/3);
    wait(0.35/3);
    pad.tone(NOTE_AS5,0.35/3);
    wait(0.35/3);
    pad.tone(NOTE_A5,0.7);
    wait(0.7);
}

void Score::coin(Gamepad &pad)
{
    pad.tone(NOTE_B5,0.1);
    wait(0.1);
    pad.tone(NOTE_E6,0.4);
}

void Score::evolution_music(Gamepad &pad, N5110 &lcd, int cha, int year)
{
    int x = 84;
    int y = 12;
    // bar 1
    draw(lcd, cha, year, x, y);
    pad.tone(NOTE_G5,0.5/4);
    wait(0.5/4);
    pad.tone(NOTE_D5,0.5/4);
    wait(0.5/4);
    pad.tone(NOTE_G5,0.5/4);
    wait(0.5/4);
    pad.tone(NOTE_D5,0.5/4);
    wait(0.5/4);
    wait(1.5);
    // bar 2
    
    pad.tone(NOTE_G4,0.5/2);
    wait(0.5);
    lcd.clear();
    lcd.refresh();
    pad.tone(NOTE_G4,0.5/2);
    wait(0.25);
    draw(lcd, cha, year, x, y);;
    wait(0.25);
    pad.tone(NOTE_G4,0.5/2);
    wait(0.25);
    lcd.clear();
    lcd.refresh();
    wait(0.25);
    pad.tone(NOTE_G4,0.5/2);
    wait(0.5);
    draw(lcd, cha, year, x, y);
    pad.tone(NOTE_G4,0.5/2);
    wait(0.25);
    lcd.clear();
    lcd.refresh();
    wait(0.25);
    pad.tone(NOTE_G4,0.5/2);
    wait(0.25);
    draw(lcd, cha, year, x, y);
    wait(0.25);
    pad.tone(NOTE_G4,0.5/2);
    wait(0.5);
    lcd.clear();
    lcd.refresh();
    pad.tone(NOTE_A4,0.5);
    wait(0.5);
    // bar 4
    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, 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, x, y);
    pad.tone(NOTE_G4,0.5/2);
    wait(0.25);
    lcd.clear();
    lcd.refresh();
    wait(0.25);
    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, x, y);
    pad.tone(NOTE_G4,0.5/2);
    wait(0.25);
    lcd.clear();
    lcd.refresh();
    wait(0.25);
    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);
}

void Score::congrats(Gamepad &pad, N5110 &lcd, int cha, int year)
{
    draw_cong(lcd, cha, year);
    // bar 1
    pad.tone(NOTE_A5,0.4);
    wait(0.4);
    pad.tone(NOTE_F5,0.4);
    wait(0.4);
    pad.tone(NOTE_C5,0.8);
    wait(0.8);
    // bar 2
    pad.tone(NOTE_AS5,0.4/3);
    wait(0.4/3);
    pad.tone(NOTE_AS5,0.4/3);
    wait(0.4/3);
    pad.tone(NOTE_AS5,0.4/3);
    wait(0.4/3);
    pad.tone(NOTE_G5,0.4/3);
    wait(0.4/3);
    pad.tone(NOTE_G5,0.4/3);
    wait(0.4/3);
    pad.tone(NOTE_AS5,0.4/3);
    wait(0.4/3);
    pad.tone(NOTE_A5,0.8);
    wait(0.8);
}

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();
}

void Score::draw_cong(N5110 &lcd, int cha, int year)
{
    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 == 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();
}

void Score::win(Gamepad &pad)
{
    // bar 1
    pad.tone(NOTE_E5,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_FS5,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_GS5,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_A5,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_B5,0.33*3);
    wait(0.33*3);
    // bar 2
    pad.tone(NOTE_B4,0.25/2);
    wait(0.33/2);
    pad.tone(NOTE_A4,0.25/2);
    wait(0.33/2);
    pad.tone(NOTE_GS4,0.25/2);
    wait(0.33/2);
    pad.tone(NOTE_A4,0.25/2);
    wait(0.33/2);
    pad.tone(NOTE_B4,0.25/2);
    wait(0.33/2);
    pad.tone(NOTE_B4,0.25/2);
    wait(0.33/2);
    pad.tone(NOTE_B4,0.25);
    wait(0.33);
    // bar 3
    pad.tone(NOTE_CS5,0.25/2);
    wait(0.33/2);
    pad.tone(NOTE_CS5,0.25/2);
    wait(0.33/2);
    pad.tone(NOTE_CS5,0.25);
    wait(0.33);
    pad.tone(NOTE_B4,0.25/2);
    wait(0.33/2);
    pad.tone(NOTE_B4,0.25/2);
    wait(0.33/2);
    pad.tone(NOTE_B4,0.25);
    wait(0.33);
    // bar 4
    pad.tone(NOTE_B4,0.25/2);
    wait(0.33/2);
    pad.tone(NOTE_A4,0.25/2);
    wait(0.33/2);
    pad.tone(NOTE_GS4,0.25/2);
    wait(0.33/2);
    pad.tone(NOTE_A4,0.25/2);
    wait(0.33/2);
    pad.tone(NOTE_B4,0.25/2);
    wait(0.33/2);
    pad.tone(NOTE_B4,0.25/2);
    wait(0.33/2);
    pad.tone(NOTE_B4,0.25);
    wait(0.33);
    // bar 5
    pad.tone(NOTE_CS5,0.25/2);
    wait(0.33/2);
    pad.tone(NOTE_CS5,0.25/2);
    wait(0.33/2);
    pad.tone(NOTE_CS5,0.25);
    wait(0.33);
    pad.tone(NOTE_B4,0.25);
    wait(0.6);
}

void Score::exam_intro(Gamepad &pad)
{
    // bar 1
    pad.tone(NOTE_F5,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_E5,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_DS5,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_E5,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_DS5,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_D5,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_DS5,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_D5,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_CS5,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_D5,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_CS5,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_C5,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_E4,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_DS4,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_D4,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_DS4,0.33/4);
    wait(0.33/4);
    // bar 2
    pad.tone(NOTE_D4,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_C4,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_FS4,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_F4,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_E4,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_F4,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_E4,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_DS4,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_E4,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_DS4,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_D4,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_DS4,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_D4,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_C4,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_D4,0.33/4);
    wait(0.33/4);
    pad.tone(NOTE_C4,0.33/4);
    wait(0.33/4);
}

void Score::gym(Gamepad &pad, bool state)
{
    // bar 1
    pad.tone(NOTE_B4,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_FS4,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_B3,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_FS4,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_B3,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_FS4,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_B3,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_FS4,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_B4,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_FS4,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_B3,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_FS4,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_B3,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_C5,0.33*1.5);
    wait(0.33*1.5);
    // bar 3
    pad.tone(NOTE_B4,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_FS4,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_B3,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_FS4,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_B3,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_FS4,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_B3,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_FS4,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_B4,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_FS4,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_B3,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_FS4,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_B3,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_AS4,0.33*1.5);
    wait(0.33*1.5);
    // bar 5
    pad.tone(NOTE_B4,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_FS4,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_B3,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_FS4,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_B3,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_FS4,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_B3,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_FS4,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_B4,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_FS4,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_B3,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_FS4,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_B3,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_C5,0.33*1.5);
    wait(0.33*1.5);
    // bar 7
    pad.tone(NOTE_B4,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_FS4,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_B3,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_FS4,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_B3,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_FS4,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_B3,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_FS4,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_B4,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_FS4,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_B3,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_FS4,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_B3,0.33/2);
    wait(0.33/2);
    pad.tone(NOTE_CS5,0.33*1.5);
    wait(0.33*1.5);
    while(state){
        // bar 8 
        pad.tone(NOTE_DS5,0.33);
        wait(0.33);
        pad.tone(NOTE_CS5,0.33);
        wait(0.33);
        pad.tone(NOTE_DS5,0.33);
        wait(0.33);
        pad.tone(NOTE_E5,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_FS5,0.33);
        wait(0.33);
        pad.tone(NOTE_E5,0.33);
        wait(0.33);
        pad.tone(NOTE_DS5,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_CS5,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_B4,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_CS5,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_DS5,0.33/2);
        wait(0.33/2);
        // bar 10
        pad.tone(NOTE_A4,0.33*2);
        wait(0.33*2);
        pad.tone(NOTE_CS5,0.33*2);
        wait(0.33*2);
        pad.tone(NOTE_E5,0.33*2);
        wait(0.33*2);
        pad.tone(NOTE_CS5,0.33*2);
        wait(0.33*2);
        // bar 8 
        pad.tone(NOTE_DS5,0.33);
        wait(0.33);
        pad.tone(NOTE_CS5,0.33);
        wait(0.33);
        pad.tone(NOTE_DS5,0.33);
        wait(0.33);
        pad.tone(NOTE_E5,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_FS5,0.33);
        wait(0.33);
        pad.tone(NOTE_E5,0.33);
        wait(0.33);
        pad.tone(NOTE_DS5,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_CS5,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_B4,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_CS5,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_DS5,0.33/2);
        wait(0.33/2);
        // bar 12
        pad.tone(NOTE_CS5,0.33*2);
        wait(0.33*2);
        pad.tone(NOTE_B4,0.33*2);
        wait(0.33*2);
        pad.tone(NOTE_A4,0.33*2);
        wait(0.33*2);
        pad.tone(NOTE_E5,0.33);
        wait(0.33);
        pad.tone(NOTE_E5,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_CS5,0.33/2);
        wait(0.33/2);
        // bar 14
        pad.tone(NOTE_B3,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_B3,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_D4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_CS4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_B3,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_D4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_B3,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_B3,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_E4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_D4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_B3,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_E4,0.33/4);
        wait(0.33/4);
        // bar 15
        pad.tone(NOTE_B3,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_B3,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_FS4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_E4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_CS4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_FS4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_B3,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_E4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_CS4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_E4,0.25/2);
        wait(0.33/2);
        pad.tone(NOTE_F4,0.25/2);
        wait(0.33/2);
        // bar 16
        pad.tone(NOTE_D4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_CS4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_B3,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_D4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_B3,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_B3,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_E4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_D4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_B3,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_E4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_B3,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_B3,0.33/2);
        wait(0.33/2);
        // bar 17
        pad.tone(NOTE_FS4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_E4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_CS4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_FS4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_E4,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_CS4,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_D4,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_CS4,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_FS4,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_E4,0.33/2);
        wait(0.33/2);
        // bar 18
        pad.tone(NOTE_B3,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_B3,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_B4,0.33);
        wait(0.33);
        pad.tone(NOTE_C5,0.33);
        wait(0.33);
        pad.tone(NOTE_A4,0.33);
        wait(0.33);
        pad.tone(NOTE_B4,0.33);
        wait(0.33);
        pad.tone(NOTE_C5,0.33);
        wait(0.33);
        pad.tone(NOTE_A4,0.33);
        wait(0.33);
        pad.tone(NOTE_G4,0.33);
        wait(0.33);
        // bar 19
        pad.tone(NOTE_FS4,0.33*4);
        wait(0.33);
        pad.tone(NOTE_C4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_B3,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_A3,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_B3,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_C4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_B3,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_A3,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_B3,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_C4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_B3,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_A3,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_B3,0.33/4);
        wait(0.33/4);
        // bar 20
        pad.tone(NOTE_C4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_CS4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_D4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_DS4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_E4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_DS4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_D4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_CS4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_C4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_B3,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_AS3,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_A3,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_GS3,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_G3,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_FS3,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_G3,0.33/4);
        wait(0.33/4);
        // bar 22
        pad.tone(NOTE_GS3,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_A3,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_AS3,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_B3,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_B4,0.33);
        wait(0.33);
        pad.tone(NOTE_C5,0.33);
        wait(0.33);
        pad.tone(NOTE_A4,0.33);
        wait(0.33);
        pad.tone(NOTE_B4,0.33);
        wait(0.33);
        pad.tone(NOTE_C5,0.33);
        wait(0.33);
        pad.tone(NOTE_A4,0.33);
        wait(0.33);
        pad.tone(NOTE_C5,0.33);
        wait(0.33);
        pad.tone(NOTE_B4,0.33*4);
        wait(0.33*4);
        pad.tone(NOTE_FS5,0.33*4);
        wait(0.33*4);
        // bar 26
        pad.tone(NOTE_B3,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_B3,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_A4,0.33*3);
        wait(0.33*3);
        pad.tone(NOTE_B3,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_B3,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_CS5,0.33*3);
        wait(0.33*3);
        pad.tone(NOTE_DS4,0.33);
        wait(0.33);
        pad.tone(NOTE_CS4,0.33);
        wait(0.33);
        pad.tone(NOTE_DS4,0.33);
        wait(0.33);
        pad.tone(NOTE_E4,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_FS4,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_B3,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_B3,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_CS4,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_FS4,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_B4,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_FS4,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_DS4,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_FS4,0.33/2);
        wait(0.33/2);
        // bar 30
        pad.tone(NOTE_B3,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_B3,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_CS5,0.33*3);
        wait(0.33*3);
        pad.tone(NOTE_A5,0.33*2);
        wait(0.33*2);
        pad.tone(NOTE_E5,0.33*2);
        wait(0.33*2);
        // bar 32
        pad.tone(NOTE_B5,0.33*4);
        wait(0.33);
        pad.tone(NOTE_E4,0.33);
        wait(0.33);
        pad.tone(NOTE_CS4,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_DS4,0.33*1.5);
        wait(0.33*1.5);
        pad.tone(NOTE_FS4,0.33);
        wait(0.33);
        pad.tone(NOTE_E4,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_DS4,0.33);
        wait(0.33);
        pad.tone(NOTE_E4,0.33*1.5);
        wait(0.33*1.5);
        // bar 34
        pad.tone(NOTE_DS4,0.33);
        wait(0.33);
        pad.tone(NOTE_E4,0.33);
        wait(0.33);
        pad.tone(NOTE_CS4,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_DS4,0.33*1.5);
        wait(0.33*1.5);
        pad.tone(NOTE_FS4,0.33);
        wait(0.33);
        pad.tone(NOTE_A4,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_GS4,0.33);
        wait(0.33);
        pad.tone(NOTE_G4,0.33*1.5);
        wait(0.33/2);
        pad.tone(NOTE_B4,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_DS5,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_FS5,0.33/4);
        wait(0.33/4);
        pad.tone(NOTE_AS5,0.33/4);
        wait(0.33/4);
        // bar 36
        pad.tone(NOTE_B5,0.33*4);
        wait(0.33);
        pad.tone(NOTE_E4,0.33);
        wait(0.33);
        pad.tone(NOTE_CS4,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_DS4,0.33*1.5);
        wait(0.33*1.5);
        pad.tone(NOTE_FS5,0.33);
        wait(0.33);
        pad.tone(NOTE_DS4,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_CS4,0.33);
        wait(0.33);
        pad.tone(NOTE_C4,0.33*1.5);
        wait(0.33*1.5);
        // bar 38
        pad.tone(NOTE_A5,0.33*4);
        wait(0.33);
        pad.tone(NOTE_E4,0.33);
        wait(0.33);
        pad.tone(NOTE_CS4,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_DS4,0.33*1.5);
        wait(0.33*1.5);
        pad.tone(NOTE_CS6,0.33);
        wait(0.33);
        pad.tone(NOTE_A4,0.33/2);
        wait(0.33/2);
        pad.tone(NOTE_GS4,0.33);
        wait(0.33);
        pad.tone(NOTE_A5,0.33*1.5);
        wait(0.33*1.5);
    }
}