![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
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: Game_one/Game_one.cpp
- Revision:
- 4:5bc9c4363d31
- Parent:
- 2:464c7e62d97d
- Child:
- 5:bc0691d02fd5
--- a/Game_one/Game_one.cpp Wed Apr 03 03:19:59 2019 +0000 +++ b/Game_one/Game_one.cpp Wed Apr 03 18:40:43 2019 +0000 @@ -10,6 +10,11 @@ } +//Enumerate instruction menu from page 1 - 3 +enum Page { + PAGE_1, PAGE_2, PAGE_3 +}; + void Game_one::init(int speed, int cha, int r) { // Set the speed of the objects @@ -204,4 +209,52 @@ wait(0.1); } _count = 10; +} + +void Game_one::intro(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::A_PRESSED) == false){ + switch (currentPage) { + case PAGE_1: + lcd.clear(); + lcd.printString("Squirtle",0,0); + lcd.printString("is rushing",0,1); + lcd.printString("to his lecture",0,2); + lcd.printString("Collect coins",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("so he can have",0,0); + lcd.printString("lunch and ",0,1); + lcd.printString("reach the",0,2); + lcd.printString("classroom in",0,3); + lcd.printString("time by ",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("avoiding the",0,0); + lcd.printString("blocks",0,1); + lcd.printString("Press A",0,5); + lcd.refresh(); + wait(1.0f/fps); + + } + } } \ No newline at end of file