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

main.cpp

Committer:
yfkwok
Date:
2019-04-12
Revision:
10:adff3c804985
Parent:
5:bc0691d02fd5
Child:
11:5a6b9dffd78a

File content as of revision 10:adff3c804985:

/*
ELEC2645 Embedded Systems Project
School of Electronic & Electrical Engineering
University of Leeds
Name: Yiu Fai Kwok
Username: el17yfk
Student ID Number: 201198802
Date: 11/03/2019
*/

#include "mbed.h"
#include "N5110.h"
#include "Gamepad.h"
#include "Score.h"
#include "Start.h"
#include "Game_one.h"
#include "Exam.h"

/////////////// objects ///////////////
N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);  // K64F - pwr from 3V3
Gamepad pad;
Score music;
Start start;
Game_one game_1;
Exam test;

///////////// prototypes ///////////////
void init();
void welcome();
int menu();
void year_one();
void year_one_set();
void year_two();
void year_two_set();
void year_three();
void year_three_set();
void instruction();
void term_one();
void term_two();
void term_three();
void win();
void lose();
void passed();
void failed();

//Starting states
enum StartStates {
    TITLE, MENU, INSTRUCTION 
};

//Game states
enum GameStates {
    YEAR_1, STARTER, BULBASAUR, SQUIRTLE, CHARMANDER, EXAM, YEAR_2, YEAR_3, GRADUATION
};

//Enumerate instruction menu from page 1 - 3
enum Page {
    PAGE_1, PAGE_2, PAGE_3   
};

//Global variables
int score = 0;
int game_1_speed = 0;
int game_1_cha = 0;
int game_1_r = 1;
int select = 0;
int year = 0;
int pass = 0;

///////////// functions ////////////////
int main(){
    
    // Initialise parameters
    int fps = 8;  // frames per second

    init();     // initialise and then display welcome screen...
    StartStates currentState = TITLE;
    GameStates currentGame = YEAR_1;
    
    while(1){
        switch (currentState) {
        case TITLE:
            //1. Display title screen and play title music
            //2. Proceed to Start screen by pressing start
            welcome();
            wait(1.0f/fps);
            currentState = MENU;
        break;
        
        case MENU:
            //1. Display starting menu
            //2. If Start is selected, initiate game
            //3. If Instruction is selected, give instruction
            int op = menu();
            if (op == 1){currentState = INSTRUCTION;}
            else {
                while(1){
                    // Game loop
                    switch (currentGame) {
                        case YEAR_1:
                            // 1. Initiate year 1 screen
                            // 2. Choosing starter pokemon to start the mini game
                            year_one();
                            year_one_set();
                            currentGame = STARTER;
                        break;
                        case STARTER:
                            select = 0;
                            start.init(pad);
                            start.starter_draw(lcd);
                            wait(1.0f/fps);
                            while(pad.check_event(Gamepad::START_PRESSED) == false)
                                {
                                    start.starter_update(pad);
                                    start.starter_draw(lcd);
                                    if(pad.check_event(Gamepad::A_PRESSED) == true){
                                        select = start.get_select(start.update_select(pad));
                                        start.intro(select, pad, lcd);
                                    }
                                    wait(1.0f/fps);
                                }
                            select = start.get_select(start.update_select(pad));
                            if(select == 1){
                                music.congrats(pad, lcd, select, year);
                                while(pad.check_event(Gamepad::A_PRESSED) == false){
                                    lcd.printString("PRESS A",0,5);
                                    lcd.refresh();
                                    wait(0.3);
                                    lcd.printString("       ",0,5);
                                    lcd.refresh();
                                    wait(0.3);
                                }
                                game_1.intro(pad, lcd);
                                currentGame = SQUIRTLE;
                            }
                            else if(select == 0){
                                music.congrats(pad, lcd, select, year);
                                while(pad.check_event(Gamepad::A_PRESSED) == false){
                                    lcd.printString("PRESS A",0,5);
                                    lcd.refresh();
                                    wait(0.3);
                                    lcd.printString("       ",0,5);
                                    lcd.refresh();
                                    wait(0.3);
                                }
                                currentGame = BULBASAUR;}
                            else if(select == 2){
                                music.congrats(pad, lcd, select, year);
                                while(pad.check_event(Gamepad::A_PRESSED) == false){
                                    lcd.printString("PRESS A",0,5);
                                    lcd.refresh();
                                    wait(0.3);
                                    lcd.printString("       ",0,5);
                                    lcd.refresh();
                                    wait(0.3);
                                }
                                currentGame = CHARMANDER;}
                        break;
                        case BULBASAUR:
                            score = 3;
                            currentGame = EXAM;
                        break;
                        case SQUIRTLE:
                            int i = 0;
                            score = 0;
                            while(i < 3){
                                if(i == 0) {term_one();}
                                else if(i == 1) {term_two();}
                                else{term_three();}
                                game_1.init(game_1_speed, game_1_cha, game_1_r);
                                int j = 0;
                                while(j < 10){
                                    game_1.read_input(pad);
                                    game_1.update(pad, lcd);
                                    game_1.render(lcd, game_1_cha);
                                    wait(1.0f/fps);
                                    j = game_1.get_count();
                                }
                                i = i++;
                                if(game_1.print_scores(lcd) >= 8) {
                                    win();
                                    music.win(pad);
                                    wait(0.5);
                                    score++;
                                }
                                else {
                                    lose();
                                    pad.tone(750.0,0.2);
                                    wait(0.5);
                                    pad.tone(750.0,0.2);
                                    wait(1.0);
                                }
                            }
                            currentGame = EXAM;
                            
                        break;
                        case CHARMANDER:
                            score = 2;
                            currentGame = EXAM;
                        break;
                        case EXAM:
                            test.exam_title(pad, lcd);
                            if(year == 0) {pass = test.exam_q_one(pad, lcd, score);}
                            else if(year == 1) {pass = test.exam_q_two(pad, lcd, score);}
                            else if(year == 2) {pass = test.exam_q_three(pad, lcd, score);}
                            if(pass >= 2){
                                passed();
                                music.win(pad);
                                wait(0.5);
                                year = year + 2;
                                if(year == 1){currentGame = YEAR_2;}
                                else if(year == 2){currentGame = YEAR_3;}
                                else if(year == 3){currentGame = GRADUATION;}
                            }
                            else {
                                failed();
                                pad.tone(750.0,0.2);
                                wait(0.5);
                                pad.tone(750.0,0.2);
                                wait(1.0);
                                if(year == 0){currentGame = YEAR_1;}
                                else if(year == 1){
                                    if(select == 1){currentGame = SQUIRTLE;}
                                    else if(select == 0){currentGame = BULBASAUR;}
                                    else if(select == 2){currentGame = CHARMANDER;}
                                }
                                else if(year == 2){
                                    if(select == 1){currentGame = SQUIRTLE;}
                                    else if(select == 0){currentGame = BULBASAUR;}
                                    else if(select == 2){currentGame = CHARMANDER;}
                                }
                            }
                        break;
                        case YEAR_2:
                            year_two();
                            year_two_set();
                            if(select == 1){
                                music.evolution_music(pad, lcd, select, year);
                                while(pad.check_event(Gamepad::A_PRESSED) == false){
                                    lcd.printString("PRESS A",0,5);
                                    lcd.refresh();
                                    wait(0.3);
                                    lcd.printString("       ",0,5);
                                    lcd.refresh();
                                    wait(0.3);
                                }
                                currentGame = SQUIRTLE;
                            }
                            else if(select == 0){
                                music.evolution_music(pad, lcd, select, year);
                                while(pad.check_event(Gamepad::A_PRESSED) == false){
                                    lcd.printString("PRESS A",0,5);
                                    lcd.refresh();
                                    wait(0.3);
                                    lcd.printString("       ",0,5);
                                    lcd.refresh();
                                    wait(0.3);
                                }
                                currentGame = BULBASAUR;}
                            else if(select == 2){
                                music.evolution_music(pad, lcd, select, year);
                                while(pad.check_event(Gamepad::A_PRESSED) == false){
                                    lcd.printString("PRESS A",0,5);
                                    lcd.refresh();
                                    wait(0.3);
                                    lcd.printString("       ",0,5);
                                    lcd.refresh();
                                    wait(0.3);
                                }
                                currentGame = CHARMANDER;}
                        break;
                        case YEAR_3:
                            year_three();
                            year_three_set();
                            if(select == 1){
                                music.evolution_music(pad, lcd, select, year);
                                while(pad.check_event(Gamepad::A_PRESSED) == false){
                                    lcd.printString("PRESS A",0,5);
                                    lcd.refresh();
                                    wait(0.3);
                                    lcd.printString("       ",0,5);
                                    lcd.refresh();
                                    wait(0.3);
                                }
                                currentGame = SQUIRTLE;
                            }
                            else if(select == 0){
                                music.evolution_music(pad, lcd, select, year);
                                while(pad.check_event(Gamepad::A_PRESSED) == false){
                                    lcd.printString("PRESS A",0,5);
                                    lcd.refresh();
                                    wait(0.3);
                                    lcd.printString("       ",0,5);
                                    lcd.refresh();
                                    wait(0.3);
                                }
                                currentGame = BULBASAUR;}
                            else if(select == 2){
                                music.evolution_music(pad, lcd, select, year);
                                while(pad.check_event(Gamepad::A_PRESSED) == false){
                                    lcd.printString("PRESS A",0,5);
                                    lcd.refresh();
                                    wait(0.3);
                                    lcd.printString("       ",0,5);
                                    lcd.refresh();
                                    wait(0.3);
                                }
                                currentGame = CHARMANDER;}
                        break;
                        case GRADUATION:
                            lcd.clear();
                            lcd.printString("GRADUATION!",0,0);
                            lcd.refresh();
                            wait(2.0);
                        break;
                    }
                }
            }
        break;
        
        case INSTRUCTION:
            instruction();
            currentState = MENU;
        break;
        }
    }
}

// initialies all classes and libraries
void init()
{
    lcd.init();
    pad.init();
    // change set contrast in range 0.0 to 1.0
    // 0.4 appears to be a good starting point
    lcd.setContrast(0.45);
}

// simple splash screen displayed on start-up
void welcome() 
{    
        lcd.clear();
        static int title_data[] = {
            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,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,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,1,0,0,0,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,1,0,0,1,0,0,0,0,1,0,0,0,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,1,1,1,0,1,1,1,0,0,0,1,0,1,1,0,0,0,0,0,0,0,1,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,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,0,1,0,1,0,1,0,0,1,1,1,1,1,1,0,0,1,1,1,1,1,0,0,1,0,0,0,0,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,1,1,0,0,0,0,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0,0,1,1,1,1,1,1,1,0,0,1,1,1,0,0,1,1,1,1,0,0,1,1,1,1,0,
            0,1,0,0,1,1,1,0,0,1,1,0,0,1,1,1,0,0,1,1,0,0,1,1,1,0,0,1,1,0,0,1,1,0,0,1,1,1,0,0,1,1,1,1,1,1,1,0,0,1,1,1,0,0,1,1,0,1,0,0,1,1,1,0,0,
            0,1,0,0,1,1,1,0,0,1,1,1,0,0,0,0,0,1,1,1,0,0,1,1,1,0,0,1,1,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,1,1,0,0,1,1,1,0,0,1,1,0,1,0,0,1,1,0,0,0,
            0,1,1,1,1,1,0,1,1,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,0,1,1,1,1,1,0,0,0,
            0,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,1,1,0,0,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,0,0,1,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
        };

        lcd.drawSprite(10, 3, 35, 65, title_data);
  
        static int start_data[] = {
            1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,0,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,0,1,1,1,
            1,0,1,0,1,0,1,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,1,0,1,0,1,0,1,0,0,1,0,
            1,1,1,0,1,1,1,0,1,1,1,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,1,1,1,0,1,1,1,0,0,1,0,
            1,0,0,0,1,1,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,1,0,0,1,0,1,0,1,1,0,0,0,1,0,
            1,0,0,0,1,0,1,0,1,1,1,0,1,1,1,0,1,1,1,0,0,0,1,1,1,0,0,1,0,0,1,0,1,0,1,0,1,0,0,1,0
        };
        
        lcd.drawSprite(22, 41, 5, 41, start_data);
        lcd.refresh();
        music.title_music(pad);

}

int menu()
{
    // clear screen, re-draw and refresh
    lcd.clear();
    pad.init();
    int pos_y = 5;
    while(pad.check_event(Gamepad::A_PRESSED) == false){
        lcd.clear();
        if(pad.get_direction() == N){
            pos_y = 5;
        }else if(pad.get_direction() == S){
            pos_y = 16;
        }
        static int arrow_data[] = {
            1,1,0,0,0,
            0,1,1,0,0,
            0,0,1,1,0,
            0,0,0,1,1,
            0,0,1,1,0,
            0,1,1,0,0,
            1,1,0,0,0
        };
        lcd.drawSprite(5, pos_y, 7, 5, arrow_data);
        
        int op_one_data[7][26] = {
            {1,1,1,1,0,1,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,1},
            {1,0,0,1,0,0,0,1,0,0,0,1,0,0,1,0,1,0,0,1,0,0,0,1,0,0},
            {1,0,0,0,0,0,0,1,0,0,0,1,0,0,1,0,1,0,0,1,0,0,0,1,0,0},
            {1,1,1,1,0,0,0,1,0,0,0,1,1,1,1,0,1,1,1,0,0,0,0,1,0,0},
            {0,0,0,1,0,0,0,1,0,0,0,1,0,0,1,0,1,0,0,1,0,0,0,1,0,0},
            {0,0,0,1,0,0,0,1,0,0,0,1,0,0,1,0,1,0,0,1,0,0,0,1,0,0},
            {1,1,1,1,0,0,0,1,0,0,0,1,0,0,1,0,1,0,0,1,0,0,0,1,0,0},
        };
        lcd.drawSprite(18, 5, 7, 26, (int *)op_one_data);
        
        int op_two_data[7][18] = {
            {1,1,1,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1},
            {0,1,0,0,1,0,0,1,0,1,0,0,1,0,1,0,0,1},
            {0,1,0,0,1,0,0,1,0,1,0,0,0,0,1,0,0,1},
            {0,1,0,0,1,0,0,1,0,1,1,1,0,0,1,0,0,1},
            {0,1,0,0,1,0,0,1,0,1,0,0,0,0,1,0,0,1},
            {0,1,0,0,1,0,0,1,0,1,0,0,0,0,1,0,0,1},
            {1,1,1,0,1,0,0,1,0,1,0,0,0,0,1,1,1,1},
        };
        lcd.drawSprite(18, 16, 7, 18, (int*) op_two_data);
        
        int instruct_data[] = {
            1,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,1,1,1,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,
            1,0,0,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,1,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,
            1,0,0,1,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,0,0,0,1,0,0,1,0,0,0,0,1,1,1,0,0,1,1,1,1,0,0,0,0,1,1,1,1,0,1,1,1,1,0,1,0,1,1,1,1,0,1,1,1,1,0,1,1,1,0,
            1,1,1,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0,0,1,0,1,0,0,0,
            1,0,0,0,0,1,0,0,0,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,1,1,1,1,0,1,1,1,1,0,1,0,1,1,1,1,0,1,0,0,0,0,1,0,0,0,
            1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,1,0,0,1,0,1,0,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0,0,1,0,1,0,0,0,0,1,0,0,1,0,1,0,0,1,
            1,0,0,0,0,1,0,0,0,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,0,0,0,1,0,0,1,0,0,0,0,1,1,1,1,0,1,1,1,1,0,0,0,0,1,1,1,1,0,1,1,1,1,0,1,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1
        };
        lcd.drawSprite(5, 38, 7, 75, instruct_data);
        lcd.refresh();
        
    }
    
    //return value for which menu option is currently selected
    int op = 0;
    if(pos_y == 5){op = 0;}
    else if(pos_y == 16){op = 1;}
    
    //return value for which menu option is currently selected
    return op;

}

void year_one()
{
    lcd.clear();
    static int instruct_data[] = {
        1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,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,0,0,0,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,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,0,0,0,1,1,0,0,1,1,0,0,0,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,0,0,1,1,0,0,0,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,0,0,1,1,0,0,1,1,0,0,0,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,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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
    };
    lcd.drawSprite(4, 9, 30, 78, instruct_data);
    lcd.refresh();
    
    music.level_up(pad);
    
    wait(1.0);
}

void year_one_set()
{
    game_1_speed = 9;
    game_1_cha = 1;
    game_1_r = 5;
}

void year_two()
{
    lcd.clear();
    static int year_two_data[] = {
        1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,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,0,0,0,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,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,0,0,0,1,1,0,0,1,1,0,0,0,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,0,0,1,1,0,0,0,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,0,0,1,1,0,0,1,1,0,0,0,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,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,
        1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,
        1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,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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,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,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,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,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,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,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,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    };
    lcd.drawSprite(4, 9, 30, 78, year_two_data);
    lcd.refresh();
    
    music.level_up(pad);
    
    wait(1.0);
}

void year_two_set()
{
    game_1_speed = 12;
    game_1_cha = 2;
    game_1_r = 3;
}

void year_three()
{
    lcd.clear();
    static int year_three_data[] = {
        1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,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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,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,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,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,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,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    };
    lcd.drawSprite(4, 9, 30, 78, year_three_data);
    lcd.refresh();
    
    music.level_up(pad);
    
    wait(1.0);
}

void year_three_set()
{
    game_1_speed = 14;
    game_1_cha = 3;
    game_1_r = 2;
}

void instruction()
{
    Page currentPage = PAGE_1;
    int fps = 8.0;
    static int instruct_data[] = {
                    1,1,1,1,1,1,1,
                    0,1,1,1,1,1,0,
                    0,0,1,1,1,0,0,
                    0,0,0,1,0,0,0
                };
    
    while(pad.check_event(Gamepad::BACK_PRESSED) == false){
        switch (currentPage) {
            case PAGE_1:
                lcd.clear();
                lcd.printString("PKM Academy",0,0);
                lcd.printString("is an RPG",0,1);
                lcd.printString("which simulates",0,2);
                lcd.printString("the mundane",0,3);
                lcd.printString("life of three",0,4);
                lcd.drawSprite(39, 44, 4, 7, instruct_data);
                lcd.refresh();
                if(pad.get_direction() == S){currentPage = PAGE_2;}
                wait(1.0f/fps);
            break;
            case PAGE_2:
                lcd.clear();
                lcd.printString("uni students.",0,0);
                lcd.printString("Explore and",0,1);
                lcd.printString("conquer all",0,2);
                lcd.printString("challenges uni",0,3);
                lcd.printString("brings forth.",0,4);
                lcd.drawSprite(39, 44, 4, 7, instruct_data);
                lcd.refresh();
                if(pad.get_direction() == S){currentPage = PAGE_3;}
                wait(1.0f/fps);
            break;
            case PAGE_3:
                lcd.clear();
                lcd.printString("Ride with them",0,0);
                lcd.printString("the life of",0,1);
                lcd.printString("frustration,",0,2);
                lcd.printString("anger and ",0,3);
                lcd.printString("despair! ",0,4);
                lcd.printString("Press BACK",12,5);
                lcd.refresh();
                wait(1.0f/fps);
            break;
        }
    }
}

void term_one()
{
    lcd.clear();
    static int term_data[] = {
        1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,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,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,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,1,1,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,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,
        0,0,0,0,0,0,0,0,1,1,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,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,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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

    };
    lcd.drawSprite(4, 9, 30, 78, term_data);
    lcd.refresh();
    
    music.level_up(pad);
    
    wait(1.0);
}

void term_two()
{
    lcd.clear();
    static int term_data[] = {
        1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,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,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,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,1,1,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,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,
        0,0,0,0,0,0,0,0,1,1,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,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,
        0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,
        0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,1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,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,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,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,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,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,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,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,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

    };
    lcd.drawSprite(4, 9, 30, 78, term_data);
    lcd.refresh();
    
    music.level_up(pad);
    
    wait(1.0);
}

void term_three()
{
    lcd.clear();
    static int term_data[] = {
        1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,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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,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,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,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,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0

    };
    lcd.drawSprite(4, 9, 30, 78, term_data);
    lcd.refresh();
    
    music.level_up(pad);
    
    wait(1.0);
}

void win()
{
    static int instruct_data[] = {
        1,1,1,1,0,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,0,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,
        1,0,0,1,1,1,0,0,1,1,0,0,1,1,1,0,0,0,0,0,1,1,1,1,0,0,0,0,0,1,1,1,0,0,1,1,1,0,0,0,0,0,1,1,1,0,0,1,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,
        1,0,0,0,1,0,0,0,1,1,0,0,1,1,0,0,1,1,1,0,0,1,1,0,0,1,1,1,0,0,1,1,0,0,1,1,0,0,1,1,1,0,0,1,1,0,0,0,1,1,0,0,1,1,0,0,0,0,0,0,0,0,0,
        1,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,1,1,1,1,1,1,1,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0,0,1,1,1,1,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,1,1,1,1,0,0,0,0,0,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,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
        0,0,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,0
    };
    lcd.clear();
    lcd.drawSprite(10, 13, 22, 63, instruct_data);
    lcd.refresh();
}

void lose()
{
    static int instruct_data[] = {
        1,1,1,1,0,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,0,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,0,0,0,0,
        1,0,0,1,1,1,0,0,1,1,0,0,1,1,1,0,0,0,0,0,1,1,1,1,0,0,0,0,0,1,1,1,0,0,1,1,1,0,0,0,0,0,1,1,1,0,0,1,1,1,0,0,1,1,0,0,0,0,
        1,0,0,0,1,0,0,0,1,1,0,0,1,1,0,0,1,1,1,0,0,1,1,0,0,1,1,1,0,0,1,1,0,0,1,1,0,0,1,1,1,0,0,1,1,0,0,0,1,1,0,0,1,1,0,0,0,0,
        1,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,0,0,1,1,0,0,1,1,1,0,0,1,1,0,0,0,0,1,0,0,1,1,0,0,0,0,
        1,0,0,1,0,1,0,0,1,1,0,0,1,1,1,0,0,0,0,0,1,1,1,1,0,0,0,0,0,1,1,1,0,0,1,1,0,0,1,1,1,0,0,1,1,0,0,1,0,0,0,0,1,1,0,0,0,0,
        1,0,0,1,1,1,0,0,1,1,0,0,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0,0,0,0,1,1,
        1,0,0,1,1,1,1,1,1,1,0,0,1,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,0,1,0,0,1,1,1,0,0,1,1,0,0,1,1,1,0,0,1,1,0,0,1,1,1,1,1,1,1,
        1,0,0,1,1,1,1,1,1,1,0,0,1,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,0,1,0,0,1,1,1,0,0,1,1,0,0,1,1,1,0,0,1,1,0,0,1,1,1,1,1,1,1,
        1,0,0,0,0,0,0,1,1,1,0,0,1,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,0,1,0,0,1,1,1,0,0,1,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,1,1,0,
        1,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0,1,1,0,0,0,1,0,0,1,1,1,0,0,1,1,0,0,1,1,1,0,0,1,1,0,0,1,1,1,1,1,1,0,
        1,0,0,1,1,1,1,1,1,1,0,0,1,1,1,0,0,1,1,0,0,1,1,0,0,1,1,1,1,1,1,0,0,1,1,1,0,0,1,1,0,0,1,1,1,0,0,1,1,0,0,1,1,1,1,1,1,0,
        1,0,0,1,1,0,0,0,0,1,0,0,1,1,1,0,0,1,1,0,0,1,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,1,1,1,0,0,1,1,1,0,0,1,1,0,0,0,0,0,0,0,1,1,
        1,1,1,1,1,0,0,0,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,1,1,
        0,1,1,1,1,0,0,0,0,0,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1
    };
    lcd.clear();
    lcd.drawSprite(10, 13, 22, 58, instruct_data);
    lcd.refresh();
}

void passed()
{
    static int instruct_data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1,1,1,1,0,0,1,1,1,0,0,1,1,0,0,1,1,1,0,0,1,0,0,1,0,0,1,1,1,1,1,1,1,0,0,1,1,1,0,0,1,1,0,0,1,1,1,0,0,1,1,0,0,1,1,1,0,0,1,1,0,0,1,1,1,1,1,1,1,0,0,1,1,0,0,1,1,1,
        0,0,1,0,0,1,1,0,1,1,0,0,0,0,0,1,1,1,1,0,0,0,0,0,1,1,0,0,1,0,0,1,1,0,0,0,0,1,0,0,1,1,1,0,0,1,1,1,0,0,0,0,0,1,1,1,1,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,1,1,0,
        0,0,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,1,1,0,0,0,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,0,0,
        0,0,0,1,1,1,1,0,0,0,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,0,0,0,0,1,1,1,1,0,0,0,0,0,1,1,1,1,0,1,1,1,1,0,1,1,1,1,1,1,1,0,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,0,0,0
    };
    lcd.clear();
    lcd.drawSprite(0, 19, 10, 83, instruct_data);
    lcd.refresh();
}

void failed()
{
    static int instruct_data[] = {
        1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,0,1,1,1,1,0,0,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,
        1,0,0,1,1,0,0,1,1,1,0,0,0,0,0,1,1,1,0,0,1,1,1,0,0,1,0,0,1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,1,1,1,0,0,1,1,0,0,1,1,0,0,0,1,0,0,0,0,0,0,0,1,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