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/Squirtle.cpp
- Committer:
- yfkwok
- Date:
- 2019-04-03
- Revision:
- 2:464c7e62d97d
- Child:
- 4:5bc9c4363d31
File content as of revision 2:464c7e62d97d:
#include "Squirtle.h" Squirtle::Squirtle() { } Squirtle::~Squirtle() { } //Enumerate instruction menu from page 1 - 3 enum Page { PAGE_1, PAGE_2, PAGE_3 }; void Squirtle::draw_cha1_sprite(int pos_x, int pos_y,N5110 &lcd) { static int squirtle_data[] = { 0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,1,1,1,0,0, 0,0,1,0,0,0,0,1,1,0,0,0,0,0,0,1,0,0,0,1,0, 0,1,0,0,0,0,0,0,0,1,1,0,0,0,1,0,0,0,0,0,1, 0,1,0,0,0,0,0,0,0,1,1,1,1,0,1,0,0,0,1,0,1, 1,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,1,0,0,1, 1,0,0,0,0,0,1,0,0,0,0,1,1,1,1,0,0,1,0,1,0, 1,0,0,0,0,1,1,0,0,0,0,1,1,1,1,0,1,1,1,0,0, 0,1,0,0,0,1,1,0,0,0,0,1,1,1,1,1,1,0,0,0,0, 0,0,1,1,0,0,0,0,1,1,0,0,0,1,1,1,0,0,0,0,0, 0,0,1,0,1,1,1,1,0,0,0,0,0,1,1,1,0,0,0,0,0, 0,0,0,1,1,0,0,1,0,0,0,1,0,1,1,1,0,0,0,0,0, 0,0,0,0,0,1,0,0,1,1,1,1,0,1,1,1,0,0,0,0,0, 0,0,0,0,1,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0, 0,0,0,0,0,1,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,1,1,1,0,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,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0 }; _pos_x = pos_x; _pos_y = pos_y; lcd.drawSprite(_pos_x, _pos_y, 17, 21, squirtle_data); } void Squirtle::draw_cha1_alt_sprite(int pos_x, int pos_y,N5110 &lcd) { static int squirtle_alt_data[] = { 0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,1,0,0,0,0,1,1,0,0,0,0,0,0,0,1,1,1,0,0, 0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,1,0, 0,1,0,0,0,0,0,0,0,1,1,1,1,0,1,0,0,0,0,0,1, 1,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,1,0,1, 1,0,0,0,0,0,1,0,0,0,0,1,1,1,1,0,0,1,0,0,1, 1,0,0,0,0,1,1,0,0,0,0,1,1,1,1,0,0,1,0,1,0, 0,1,0,0,0,1,1,0,0,0,0,1,1,1,1,1,1,1,1,0,0, 0,0,1,1,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0, 0,0,1,1,1,1,1,1,1,1,0,0,0,1,1,1,0,0,0,0,0, 0,0,0,1,1,0,0,1,0,0,0,1,0,1,1,1,0,0,0,0,0, 0,0,0,0,0,1,0,1,0,0,1,1,0,1,1,1,0,0,0,0,0, 0,0,0,0,0,1,1,0,1,1,0,0,1,0,1,0,0,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, 0,0,0,0,0,1,1,0,1,1,1,0,1,1,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,1,1,1,0,0,0,0,0,0,0,0,0 }; _pos_x = pos_x; _pos_y = pos_y; lcd.drawSprite(_pos_x, _pos_y, 17, 21, squirtle_alt_data); } void Squirtle::draw_cha2_sprite(int pos_x, int pos_y,N5110 &lcd) { static int squirtle_2_data[] = { 0,0,0,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0,1,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,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 }; _pos_x = pos_x; _pos_y = pos_y; lcd.drawSprite(_pos_x, _pos_y, 21, 23, squirtle_a3_data); } void Squirtle::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("Squirtle",0,0); lcd.printString("is constantly",0,1); lcd.printString("working to get",0,2); lcd.printString("money for",0,3); lcd.printString("tuition and",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("living expense.",0,0); lcd.printString("Help him to ",0,2); lcd.printString("manage the",0,3); lcd.printString("hectic work",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("and study life",0,0); lcd.printString("of his!",0,1); lcd.printString("Press B",0,5); lcd.refresh(); wait(1.0f/fps); } } }