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

Characters/Bulbasaur.cpp

Committer:
yfkwok
Date:
2019-04-03
Revision:
2:464c7e62d97d
Child:
10:adff3c804985

File content as of revision 2:464c7e62d97d:

#include "Bulbasaur.h"

Bulbasaur::Bulbasaur()
{

}

Bulbasaur::~Bulbasaur()
{

}

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

void Bulbasaur::draw_cha1_sprite(int pos_x, int pos_y,N5110 &lcd)
{
    static int bulbasaur_data[] = {
        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,1,0,0,0,1,0,0,0,0,
        0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,0,0,0,0,
        0,0,0,0,0,0,0,1,1,0,0,1,0,0,1,0,1,1,0,0,
        0,0,0,1,1,0,1,0,0,0,1,1,0,0,1,0,0,0,1,0,
        0,0,1,0,0,1,1,0,0,1,0,1,0,0,0,1,0,0,0,1,
        0,0,1,0,0,0,1,1,1,0,1,0,0,0,0,0,1,0,0,1,
        0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,1,
        0,1,0,0,0,0,0,0,0,1,1,1,0,0,0,0,1,0,1,0,
        1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,1,0,
        1,1,0,0,0,0,0,0,0,0,1,0,1,1,1,0,0,0,1,0,
        1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1,0,1,0,
        1,0,0,0,0,0,1,1,0,0,0,0,1,0,0,1,1,1,0,0,
        0,1,0,0,0,0,1,1,0,0,0,1,0,0,1,0,0,0,0,0,
        0,0,1,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,
        0,0,0,0,1,1,1,1,1,1,1,0,1,0,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
    };
    
    _pos_x = pos_x;
    _pos_y = pos_y;
    lcd.drawSprite(_pos_x, _pos_y, 17, 20, bulbasaur_data);
}

void Bulbasaur::description(Gamepad &pad, N5110 &lcd)
{
    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::B_PRESSED) == false){
        switch (currentPage) {
            case PAGE_1:
                lcd.clear();
                lcd.printString("Bulbasaur",0,0);
                lcd.printString("is so lazy",0,1);
                lcd.printString("that he never",0,2);
                lcd.printString("finds time to",0,3);
                lcd.printString("do actual work",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("Easily lured",0,0);
                lcd.printString("by YouTube",0,1);
                lcd.printString("and social",0,2);
                lcd.printString("apps! Motivate",0,3);
                lcd.printString("him so that he",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("can graduate!",0,0);
                lcd.printString("Press B",0,5);
                lcd.refresh();
                wait(1.0f/fps);
        }
    }
}