Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed FXOS8700CQ mbed-rtos
Diff: Characters/Squirtle.cpp
- Revision:
- 2:464c7e62d97d
- Child:
- 4:5bc9c4363d31
diff -r 61b67654ffb7 -r 464c7e62d97d Characters/Squirtle.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Characters/Squirtle.cpp Wed Apr 03 03:06:00 2019 +0000 @@ -0,0 +1,240 @@ +#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,0,1,1,1,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,1,0,0,0,1,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0, + 0,0,1,0,0,1,1,1,1,0,1,0,0,0,1,0,0,0,0,1,1,1,0, + 0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,1,0,0,0,1, + 0,1,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,1,0,0,1,0,1, + 0,1,0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,1,0,1,0,0,1, + 1,1,0,0,0,0,1,0,0,1,1,1,1,1,1,0,1,0,0,0,1,1,0, + 1,0,0,0,0,1,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,1,0, + 1,0,0,0,1,1,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,1,0, + 0,1,0,0,0,1,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0,1,0, + 0,0,1,1,0,0,0,0,0,1,1,0,0,0,1,1,1,0,0,0,1,0,0, + 0,0,1,0,1,1,1,0,1,0,0,0,0,0,1,1,1,0,1,1,0,0,0, + 0,0,0,1,1,0,0,0,1,0,0,0,1,0,1,1,1,1,0,0,0,0,0, + 0,0,0,0,0,1,0,0,0,1,1,1,1,0,1,1,1,0,0,0,0,0,0, + 0,0,0,0,1,0,1,1,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0, + 0,0,0,0,0,1,1,1,1,0,0,1,0,1,0,1,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,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,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, 20, 23, squirtle_2_data); +} + +void Squirtle::draw_cha2_alt_sprite(int pos_x, int pos_y,N5110 &lcd) +{ + static int squirtle_a2_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,1,1,1,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,1,0,0,1,1,1,1,0,1,1,1,1,0,0,0,0,0,0,0,0,0, + 0,0,1,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,1,1,0, + 0,1,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,1, + 0,1,0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,1,0,0,1,0,1, + 1,1,0,0,0,0,1,0,0,1,1,1,1,1,1,0,0,1,0,1,0,0,1, + 1,0,0,0,0,1,0,0,0,0,0,0,1,1,1,1,1,0,0,0,1,1,0, + 1,0,0,0,1,1,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,1,0, + 0,1,0,0,0,1,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,1,0, + 0,0,1,1,0,0,0,0,0,0,0,1,0,0,1,1,1,0,0,0,1,0,0, + 0,0,0,1,1,1,1,0,0,1,1,0,0,0,1,1,1,0,1,1,0,0,0, + 0,0,0,1,1,0,0,0,1,0,0,0,0,0,1,1,1,1,0,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,0,0,1,1,0,1,1,1,1,1,0,1,0,0,0,0,0,0,0, + 0,0,0,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0,0,0,0, + 0,0,0,0,0,1,1,0,0,1,1,0,0,1,0,0,0,0,0,1,0,0,0, + 0,0,0,0,0,1,1,1,0,0,1,0,1,1,1,1,0,0,0,1,0,0,0, + 0,0,0,0,0,0,0,0,1,1,0,1,0,1,0,0,0,0,1,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,1,0,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 + }; + + _pos_x = pos_x; + _pos_y = pos_y; + lcd.drawSprite(_pos_x, _pos_y, 21, 23, squirtle_3_data); +} + +void Squirtle::draw_cha3_alt_sprite(int pos_x, int pos_y,N5110 &lcd) +{ + static int squirtle_a3_data[] = { + 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,1,0,0,1,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0, + 0,0,0,0,1,0,0,0,0,1,1,1,0,0,0,1,0,0,1,0,0,0,0, + 0,0,0,1,1,1,1,0,1,1,1,1,1,1,1,0,1,1,0,1,0,0,0, + 0,0,0,1,0,1,1,1,1,1,1,1,1,1,0,0,1,1,0,1,0,0,0, + 0,0,0,1,0,0,0,1,1,1,1,1,1,0,0,0,0,0,1,0,0,0,0, + 0,0,1,0,0,0,0,0,0,1,0,1,1,1,0,0,0,1,0,0,0,0,0, + 0,1,0,0,0,0,0,0,0,0,0,1,1,1,1,0,1,1,1,0,0,0,0, + 0,1,0,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,0,1,0,0,0,0,1,0,1,1,1,0,1,1,1,0,0,1, + 1,0,0,0,0,1,1,0,0,0,0,1,1,0,0,0,1,0,1,1,0,1,0, + 1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,1,1,1,0,0, + 0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0, + 0,0,1,1,0,0,0,1,1,0,0,1,0,0,0,1,0,1,1,0,0,0,0, + 0,0,0,0,1,1,1,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0, + 0,0,0,0,0,0,1,0,0,0,1,1,0,0,1,0,0,0,1,0,0,0,0, + 0,0,0,0,0,0,1,1,0,0,0,1,0,1,1,0,0,0,1,0,0,0,0, + 0,0,0,0,0,0,1,1,1,1,0,1,1,0,0,0,0,1,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,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); + + } + } +} \ No newline at end of file