ELEC2645 (2018/19) / Mbed 2 deprecated el17yfk

Dependencies:   mbed FXOS8700CQ mbed-rtos

Committer:
yfkwok
Date:
Mon May 06 20:35:37 2019 +0000
Revision:
29:75a05e9f0e8d
Parent:
28:a6726a3f8e6d
Child:
33:f7ec806e14b6
06/05/2019 - Game 3 documentation added, minor tweaks to remove excess functions in Game 1 & 2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
yfkwok 21:704d938acf5d 1 #include "Game_three.h"
yfkwok 21:704d938acf5d 2
yfkwok 21:704d938acf5d 3 Game_three::Game_three()
yfkwok 21:704d938acf5d 4 {
yfkwok 21:704d938acf5d 5
yfkwok 21:704d938acf5d 6 }
yfkwok 21:704d938acf5d 7
yfkwok 21:704d938acf5d 8 Game_three::~Game_three()
yfkwok 21:704d938acf5d 9 {
yfkwok 21:704d938acf5d 10
yfkwok 21:704d938acf5d 11 }
yfkwok 21:704d938acf5d 12
yfkwok 21:704d938acf5d 13 //Enumerate instruction menu from page 1 - 4
yfkwok 21:704d938acf5d 14 enum Page {
yfkwok 21:704d938acf5d 15 PAGE_1, PAGE_2, PAGE_3, PAGE_4
yfkwok 21:704d938acf5d 16 };
yfkwok 21:704d938acf5d 17
yfkwok 28:a6726a3f8e6d 18 void Game_three::init_para()
yfkwok 28:a6726a3f8e6d 19 {
yfkwok 28:a6726a3f8e6d 20 // initiate score and round counter
yfkwok 28:a6726a3f8e6d 21 _count = 0;
yfkwok 28:a6726a3f8e6d 22 _score = 0;
yfkwok 28:a6726a3f8e6d 23 }
yfkwok 28:a6726a3f8e6d 24
yfkwok 27:4bcdfb212467 25 void Game_three::init(Gamepad &pad, int r)
yfkwok 21:704d938acf5d 26 {
yfkwok 27:4bcdfb212467 27 if (r == 1){_set = rand() % 4;} // randomise game setting for 4 possibilities.
yfkwok 27:4bcdfb212467 28 else if (r == 2){_set = rand() % 7;} // randomise game setting for 7 possibilities.
yfkwok 27:4bcdfb212467 29 else if (r == 3){_set = rand() % 4;} // randomise game setting for 4 possibilities.
yfkwok 21:704d938acf5d 30
yfkwok 27:4bcdfb212467 31 pad.init_input();
yfkwok 27:4bcdfb212467 32 }
yfkwok 27:4bcdfb212467 33
yfkwok 27:4bcdfb212467 34 void Game_three::render(N5110 &lcd, int r)
yfkwok 27:4bcdfb212467 35 {
yfkwok 27:4bcdfb212467 36 lcd.clear();
yfkwok 27:4bcdfb212467 37 draw(lcd, r);
yfkwok 28:a6726a3f8e6d 38 lcd.refresh();
yfkwok 27:4bcdfb212467 39 }
yfkwok 27:4bcdfb212467 40
yfkwok 27:4bcdfb212467 41 void Game_three::read_input(Gamepad &pad)
yfkwok 27:4bcdfb212467 42 {
yfkwok 27:4bcdfb212467 43 if (pad.check_event(Gamepad::A_PRESSED) == true){_select = 0;}
yfkwok 27:4bcdfb212467 44 else if (pad.check_event(Gamepad::B_PRESSED) == true){_select = 1;}
yfkwok 27:4bcdfb212467 45 else if (pad.check_event(Gamepad::X_PRESSED) == true){_select = 2;}
yfkwok 27:4bcdfb212467 46 else if (pad.check_event(Gamepad::Y_PRESSED) == true){_select = 3;}
yfkwok 21:704d938acf5d 47 }
yfkwok 21:704d938acf5d 48
yfkwok 27:4bcdfb212467 49 void Game_three::draw(N5110 &lcd, int r)
yfkwok 21:704d938acf5d 50 {
yfkwok 28:a6726a3f8e6d 51 lcd.clear();
yfkwok 21:704d938acf5d 52 background(lcd);
yfkwok 28:a6726a3f8e6d 53 lcd.refresh();
yfkwok 27:4bcdfb212467 54 wait(0.8);
yfkwok 27:4bcdfb212467 55 if (r == 1){
yfkwok 27:4bcdfb212467 56 if (_set == 0){book.init(0); book.draw(lcd); book.init(1); book.draw(lcd); book.init(2); book.draw(lcd); message.init(3); message.draw(lcd);}
yfkwok 27:4bcdfb212467 57 else if (_set == 1){book.init(1); book.draw(lcd); book.init(2); book.draw(lcd);book.init(3); book.draw(lcd);message.init(0); message.draw(lcd);}
yfkwok 27:4bcdfb212467 58 else if (_set == 2){book.init(2); book.draw(lcd); book.init(3); book.draw(lcd);book.init(0); book.draw(lcd);message.init(1); message.draw(lcd);}
yfkwok 27:4bcdfb212467 59 else if (_set == 3){book.init(3); book.draw(lcd); book.init(0); book.draw(lcd); book.init(1); book.draw(lcd); message.init(2); message.draw(lcd);}
yfkwok 27:4bcdfb212467 60 } else if (r == 2){
yfkwok 28:a6726a3f8e6d 61 if (_set == 0){book.init(0); book.draw(lcd); book.init(1); book.draw(lcd); message.init(2); message.draw(lcd); message.init(3); message.draw(lcd);}
yfkwok 28:a6726a3f8e6d 62 else if (_set == 1){book.init(1); book.draw(lcd); book.init(2); book.draw(lcd); message.init(3); message.draw(lcd); message.init(0); message.draw(lcd);}
yfkwok 28:a6726a3f8e6d 63 else if (_set == 2){book.init(2); book.draw(lcd); book.init(3); book.draw(lcd); message.init(0); message.draw(lcd); message.init(1); message.draw(lcd);}
yfkwok 28:a6726a3f8e6d 64 else if (_set == 3){book.init(3); book.draw(lcd); book.init(0); book.draw(lcd); message.init(1); message.draw(lcd); message.init(2); message.draw(lcd);}
yfkwok 28:a6726a3f8e6d 65 else if (_set == 4){book.init(1); book.draw(lcd); book.init(3); book.draw(lcd); message.init(0); message.draw(lcd); message.init(2); message.draw(lcd);}
yfkwok 28:a6726a3f8e6d 66 else if (_set == 5){book.init(0); book.draw(lcd); book.init(2); book.draw(lcd); message.init(1); message.draw(lcd); message.init(3); message.draw(lcd);}
yfkwok 27:4bcdfb212467 67 } else if (r == 3){
yfkwok 27:4bcdfb212467 68 if (_set == 0){message.init(0); message.draw(lcd); message.init(1); message.draw(lcd); message.init(2); message.draw(lcd); book.init(3); book.draw(lcd);}
yfkwok 27:4bcdfb212467 69 else if (_set == 1){message.init(1); message.draw(lcd); message.init(2); message.draw(lcd); message.init(3); message.draw(lcd); book.init(0); book.draw(lcd);}
yfkwok 27:4bcdfb212467 70 else if (_set == 2){message.init(2); message.draw(lcd); message.init(3); message.draw(lcd); message.init(0); message.draw(lcd); book.init(1); book.draw(lcd);}
yfkwok 27:4bcdfb212467 71 else if (_set == 3){message.init(3); message.draw(lcd); message.init(0); message.draw(lcd); message.init(1); message.draw(lcd); book.init(2); book.draw(lcd);}
yfkwok 27:4bcdfb212467 72 }
yfkwok 27:4bcdfb212467 73 }
yfkwok 27:4bcdfb212467 74
yfkwok 27:4bcdfb212467 75 void Game_three::update(Gamepad &pad, int r)
yfkwok 27:4bcdfb212467 76 {
yfkwok 27:4bcdfb212467 77 // Check if the correct option has been selected by player, update round and score
yfkwok 27:4bcdfb212467 78 if (r == 1){
yfkwok 27:4bcdfb212467 79 if (_set == 0 && ((_select == 0)|(_select == 1)|(_select == 2))){_count++; _score++; music.coin(pad);}
yfkwok 27:4bcdfb212467 80 else if (_set == 0 && _select == 3){_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 27:4bcdfb212467 81 else if (_set == 1 && ((_select == 1)|(_select == 2)|(_select == 3))){_count++; _score++; music.coin(pad);}
yfkwok 27:4bcdfb212467 82 else if (_set == 1 && _select == 0){_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 27:4bcdfb212467 83 else if (_set == 2 && ((_select == 2)|(_select == 3)|(_select == 0))){_count++; _score++; music.coin(pad);}
yfkwok 27:4bcdfb212467 84 else if (_set == 2 && _select == 1){_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 27:4bcdfb212467 85 else if (_set == 3 && ((_select == 3)|(_select == 1)|(_select == 0))){_count++; _score++; music.coin(pad);}
yfkwok 27:4bcdfb212467 86 else if (_set == 3 && _select == 2){_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 27:4bcdfb212467 87 else {_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 27:4bcdfb212467 88 } else if (r == 2){
yfkwok 27:4bcdfb212467 89 if (_set == 0 && ((_select == 0)|(_select == 1))){_count++; _score++; music.coin(pad);}
yfkwok 27:4bcdfb212467 90 else if (_set == 0 && ((_select == 2)|(_select == 3))){_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 27:4bcdfb212467 91 else if (_set == 1 && ((_select == 1)|(_select == 2))){_count++; _score++; music.coin(pad);}
yfkwok 27:4bcdfb212467 92 else if (_set == 1 && ((_select == 3)|(_select == 0))){_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 27:4bcdfb212467 93 else if (_set == 2 && ((_select == 2)|(_select == 3))){_count++; _score++; music.coin(pad);}
yfkwok 27:4bcdfb212467 94 else if (_set == 2 && ((_select == 0)|(_select == 1))){_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 27:4bcdfb212467 95 else if (_set == 3 && ((_select == 3)|(_select == 0))){_count++; _score++; music.coin(pad);}
yfkwok 27:4bcdfb212467 96 else if (_set == 3 && ((_select == 1)|(_select == 2))){_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 27:4bcdfb212467 97 else if (_set == 4 && ((_select == 1)|(_select == 3))){_count++; _score++; music.coin(pad);}
yfkwok 27:4bcdfb212467 98 else if (_set == 4 && ((_select == 0)|(_select == 2))){_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 27:4bcdfb212467 99 else if (_set == 5 && ((_select == 0)|(_select == 2))){_count++; _score++; music.coin(pad);}
yfkwok 27:4bcdfb212467 100 else if (_set == 5 && ((_select == 1)|(_select == 3))){_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 27:4bcdfb212467 101 else {_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 27:4bcdfb212467 102 } else if (r == 3){
yfkwok 27:4bcdfb212467 103 if (_set == 0 && ((_select == 0)|(_select == 1)|(_select == 2))){_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 27:4bcdfb212467 104 else if (_set == 0 && _select == 3){_count++; _score++; music.coin(pad);}
yfkwok 27:4bcdfb212467 105 else if (_set == 1 && ((_select == 1)|(_select == 2)|(_select == 3))){_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 27:4bcdfb212467 106 else if (_set == 1 && _select == 0){_count++; _score++; music.coin(pad);}
yfkwok 27:4bcdfb212467 107 else if (_set == 2 && ((_select == 2)|(_select == 3)|(_select == 0))){_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 27:4bcdfb212467 108 else if (_set == 2 && _select == 1){_count++; _score++; music.coin(pad);}
yfkwok 27:4bcdfb212467 109 else if (_set == 3 && ((_select == 3)|(_select == 1)|(_select == 0))){_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 27:4bcdfb212467 110 else if (_set == 3 && _select == 2){_count++; _score++; music.coin(pad);}
yfkwok 27:4bcdfb212467 111 else {_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 27:4bcdfb212467 112 }
yfkwok 21:704d938acf5d 113 }
yfkwok 21:704d938acf5d 114
yfkwok 21:704d938acf5d 115 void Game_three::background(N5110 &lcd)
yfkwok 21:704d938acf5d 116 {
yfkwok 21:704d938acf5d 117 int data [48][84] = {
yfkwok 28:a6726a3f8e6d 118 {0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0},
yfkwok 28:a6726a3f8e6d 119 {0,0,0,0,0,0,0,0,1,0,0,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,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0},
yfkwok 28:a6726a3f8e6d 120 {0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0},
yfkwok 28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726a3f8e6d 164 {0,0,0,0,0,0,0,0,1,0,0,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,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0},
yfkwok 28:a6726a3f8e6d 165 {0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0},
yfkwok 21:704d938acf5d 166 };
yfkwok 21:704d938acf5d 167 lcd.drawSprite(0, 0, 48, 84, (int*) data);
yfkwok 27:4bcdfb212467 168 }
yfkwok 27:4bcdfb212467 169
yfkwok 27:4bcdfb212467 170 int Game_three::get_count()
yfkwok 27:4bcdfb212467 171 {
yfkwok 27:4bcdfb212467 172 int count = _count;
yfkwok 27:4bcdfb212467 173 return count;
yfkwok 27:4bcdfb212467 174 }
yfkwok 27:4bcdfb212467 175
yfkwok 27:4bcdfb212467 176 int Game_three::get_score()
yfkwok 27:4bcdfb212467 177 {
yfkwok 27:4bcdfb212467 178 int score = _score;
yfkwok 27:4bcdfb212467 179 return score;
yfkwok 27:4bcdfb212467 180 }
yfkwok 27:4bcdfb212467 181
yfkwok 27:4bcdfb212467 182 void Game_three::intro(Gamepad &pad, N5110 &lcd)
yfkwok 27:4bcdfb212467 183 {
yfkwok 27:4bcdfb212467 184 Page currentPage = PAGE_1;
yfkwok 27:4bcdfb212467 185 int fps = 8.0;
yfkwok 27:4bcdfb212467 186 int instruct_data[4][7] = {
yfkwok 27:4bcdfb212467 187 {1,1,1,1,1,1,1},
yfkwok 27:4bcdfb212467 188 {0,1,1,1,1,1,0},
yfkwok 27:4bcdfb212467 189 {0,0,1,1,1,0,0},
yfkwok 27:4bcdfb212467 190 {0,0,0,1,0,0,0},
yfkwok 27:4bcdfb212467 191 };
yfkwok 27:4bcdfb212467 192
yfkwok 27:4bcdfb212467 193 while(pad.check_event(Gamepad::A_PRESSED) == false){
yfkwok 27:4bcdfb212467 194 switch (currentPage) {
yfkwok 27:4bcdfb212467 195 case PAGE_1:
yfkwok 27:4bcdfb212467 196 lcd.clear();
yfkwok 27:4bcdfb212467 197 lcd.printString("Bulbasaur",0,0);
yfkwok 27:4bcdfb212467 198 lcd.printString("is trying",0,1);
yfkwok 27:4bcdfb212467 199 lcd.printString("to study!",0,2);
yfkwok 27:4bcdfb212467 200 lcd.printString("Stop texting",0,4);
yfkwok 27:4bcdfb212467 201 lcd.drawSprite(39, 44, 4, 7, (int *)instruct_data);
yfkwok 27:4bcdfb212467 202 lcd.refresh();
yfkwok 27:4bcdfb212467 203 if(pad.get_direction() == S){currentPage = PAGE_2;}
yfkwok 27:4bcdfb212467 204 wait(1.0f/fps);
yfkwok 27:4bcdfb212467 205 break;
yfkwok 27:4bcdfb212467 206 case PAGE_2:
yfkwok 27:4bcdfb212467 207 lcd.clear();
yfkwok 27:4bcdfb212467 208 lcd.printString("the girls,",0,0);
yfkwok 27:4bcdfb212467 209 lcd.printString("so he can pass",0,1);
yfkwok 27:4bcdfb212467 210 lcd.printString("the test by",0,2);
yfkwok 27:4bcdfb212467 211 lcd.printString("choosing to",0,3);
yfkwok 27:4bcdfb212467 212 lcd.printString("study!",0,4);
yfkwok 27:4bcdfb212467 213 lcd.printString("Press A",0,5);
yfkwok 27:4bcdfb212467 214 lcd.refresh();
yfkwok 27:4bcdfb212467 215 wait(1.0f/fps);
yfkwok 27:4bcdfb212467 216 break;
yfkwok 27:4bcdfb212467 217 }
yfkwok 27:4bcdfb212467 218 }
yfkwok 21:704d938acf5d 219 }