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: Characters/Charmander.cpp
- Revision:
- 2:464c7e62d97d
- Child:
- 6:9104692d6c8c
- Child:
- 8:d707bb3b9106
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Characters/Charmander.cpp Wed Apr 03 03:06:00 2019 +0000 @@ -0,0 +1,92 @@ +#include "Charmander.h" + +Charmander::Charmander() +{ + +} + +Charmander::~Charmander() +{ + +} + +//Enumerate instruction menu from page 1 - 3 +enum Page { + PAGE_1, PAGE_2, PAGE_3 +}; + +void Charmander::draw_cha1_sprite(int pos_x, int pos_y,N5110 &lcd) +{ + static int charmander_data[] = { + 0,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,0,0,0,0,0,0,0,0,1,0,0,0, + 0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,1,0,0, + 0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,1,0, + 0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,1,0, + 1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,1,0,0,0,0,1, + 1,0,0,0,0,1,1,0,0,0,0,1,0,0,0,1,0,0,0,0,1, + 1,0,0,0,0,1,1,0,0,0,0,1,0,0,0,0,1,0,1,1,0, + 0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,1,0,0, + 0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,0,0, + 0,0,0,0,1,1,1,0,0,1,0,0,0,1,1,0,0,1,0,0,0, + 0,0,0,0,0,1,0,0,1,0,0,0,0,0,1,0,0,1,0,0,0, + 0,0,0,0,0,1,0,0,0,1,1,0,0,0,1,0,1,0,0,0,0, + 0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0, + 0,0,0,0,0,1,1,1,0,0,0,0,0,1,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,1,0,1,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,0,0,0 + }; + + _pos_x = pos_x; + _pos_y = pos_y; + lcd.drawSprite(_pos_x, _pos_y, 18, 21, charmander_data); +} + +void Charmander::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("Charmander",0,0); + lcd.printString("is constantly",0,1); + lcd.printString("distracted by",0,2); + lcd.printString("female friends",0,3); + lcd.printString("and messages.",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("Will he",0,0); + lcd.printString("overcome the",0,1); + lcd.printString("urge to talk",0,2); + lcd.printString("with girls",0,3); + lcd.printString("around him,",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 graduate",0,0); + lcd.printString("successfully?",0,1); + lcd.printString("Press B",0,5); + lcd.refresh(); + wait(1.0f/fps); + } + } +} \ No newline at end of file