ELEC2645 (2018/19) / Mbed 2 deprecated el17yfk

Dependencies:   mbed FXOS8700CQ mbed-rtos

Committer:
yfkwok
Date:
Wed May 08 23:57:04 2019 +0000
Revision:
33:f7ec806e14b6
Parent:
29:75a05e9f0e8d
09/05/19 - Inline comment added, functionalities complete, all Deoxygen comment added for classes

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 33:f7ec806e14b6 27 if (r == 1){_set = rand() % 4;} // randomise game setting for 4 possibilities.
yfkwok 33:f7ec806e14b6 28 else if (r == 2){_set = rand() % 7;} // randomise game setting for 7 possibilities.
yfkwok 33:f7ec806e14b6 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 33:f7ec806e14b6 43 // Set _select parameter to values dependent on which button is being pressed
yfkwok 27:4bcdfb212467 44 if (pad.check_event(Gamepad::A_PRESSED) == true){_select = 0;}
yfkwok 27:4bcdfb212467 45 else if (pad.check_event(Gamepad::B_PRESSED) == true){_select = 1;}
yfkwok 27:4bcdfb212467 46 else if (pad.check_event(Gamepad::X_PRESSED) == true){_select = 2;}
yfkwok 27:4bcdfb212467 47 else if (pad.check_event(Gamepad::Y_PRESSED) == true){_select = 3;}
yfkwok 21:704d938acf5d 48 }
yfkwok 21:704d938acf5d 49
yfkwok 27:4bcdfb212467 50 void Game_three::draw(N5110 &lcd, int r)
yfkwok 21:704d938acf5d 51 {
yfkwok 28:a6726a3f8e6d 52 lcd.clear();
yfkwok 21:704d938acf5d 53 background(lcd);
yfkwok 28:a6726a3f8e6d 54 lcd.refresh();
yfkwok 27:4bcdfb212467 55 wait(0.8);
yfkwok 33:f7ec806e14b6 56 // Draw the messages and books according the _set parameter which is dependent on which year tha game is in to vary the difficulty of the game
yfkwok 27:4bcdfb212467 57 if (r == 1){
yfkwok 33:f7ec806e14b6 58 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 33:f7ec806e14b6 59 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 33:f7ec806e14b6 60 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 33:f7ec806e14b6 61 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 62 } else if (r == 2){
yfkwok 28:a6726a3f8e6d 63 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 64 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 65 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 66 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 67 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 68 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 69 } else if (r == 3){
yfkwok 27:4bcdfb212467 70 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 71 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 72 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 73 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 74 }
yfkwok 27:4bcdfb212467 75 }
yfkwok 27:4bcdfb212467 76
yfkwok 27:4bcdfb212467 77 void Game_three::update(Gamepad &pad, int r)
yfkwok 27:4bcdfb212467 78 {
yfkwok 27:4bcdfb212467 79 // Check if the correct option has been selected by player, update round and score
yfkwok 27:4bcdfb212467 80 if (r == 1){
yfkwok 33:f7ec806e14b6 81 if (_set == 0 && ((_select == 0)|(_select == 1)|(_select == 2))){_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 33:f7ec806e14b6 82 else if (_set == 0 && _select == 3){_count++; _score++; music.coin(pad);}
yfkwok 33:f7ec806e14b6 83 else if (_set == 1 && ((_select == 1)|(_select == 2)|(_select == 3))){_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 33:f7ec806e14b6 84 else if (_set == 1 && _select == 0){_count++; _score++; music.coin(pad);}
yfkwok 33:f7ec806e14b6 85 else if (_set == 2 && ((_select == 2)|(_select == 3)|(_select == 0))){_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 33:f7ec806e14b6 86 else if (_set == 2 && _select == 1){_count++; _score++; music.coin(pad);}
yfkwok 33:f7ec806e14b6 87 else if (_set == 3 && ((_select == 3)|(_select == 1)|(_select == 0))){_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 33:f7ec806e14b6 88 else if (_set == 3 && _select == 2){_count++; _score++; music.coin(pad);}
yfkwok 27:4bcdfb212467 89 else {_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 27:4bcdfb212467 90 } else if (r == 2){
yfkwok 27:4bcdfb212467 91 if (_set == 0 && ((_select == 0)|(_select == 1))){_count++; _score++; music.coin(pad);}
yfkwok 27:4bcdfb212467 92 else if (_set == 0 && ((_select == 2)|(_select == 3))){_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 27:4bcdfb212467 93 else if (_set == 1 && ((_select == 1)|(_select == 2))){_count++; _score++; music.coin(pad);}
yfkwok 27:4bcdfb212467 94 else if (_set == 1 && ((_select == 3)|(_select == 0))){_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 27:4bcdfb212467 95 else if (_set == 2 && ((_select == 2)|(_select == 3))){_count++; _score++; music.coin(pad);}
yfkwok 27:4bcdfb212467 96 else if (_set == 2 && ((_select == 0)|(_select == 1))){_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 27:4bcdfb212467 97 else if (_set == 3 && ((_select == 3)|(_select == 0))){_count++; _score++; music.coin(pad);}
yfkwok 27:4bcdfb212467 98 else if (_set == 3 && ((_select == 1)|(_select == 2))){_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 27:4bcdfb212467 99 else if (_set == 4 && ((_select == 1)|(_select == 3))){_count++; _score++; music.coin(pad);}
yfkwok 27:4bcdfb212467 100 else if (_set == 4 && ((_select == 0)|(_select == 2))){_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 27:4bcdfb212467 101 else if (_set == 5 && ((_select == 0)|(_select == 2))){_count++; _score++; music.coin(pad);}
yfkwok 27:4bcdfb212467 102 else if (_set == 5 && ((_select == 1)|(_select == 3))){_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 27:4bcdfb212467 103 else {_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 27:4bcdfb212467 104 } else if (r == 3){
yfkwok 27:4bcdfb212467 105 if (_set == 0 && ((_select == 0)|(_select == 1)|(_select == 2))){_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 27:4bcdfb212467 106 else if (_set == 0 && _select == 3){_count++; _score++; music.coin(pad);}
yfkwok 27:4bcdfb212467 107 else if (_set == 1 && ((_select == 1)|(_select == 2)|(_select == 3))){_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 27:4bcdfb212467 108 else if (_set == 1 && _select == 0){_count++; _score++; music.coin(pad);}
yfkwok 27:4bcdfb212467 109 else if (_set == 2 && ((_select == 2)|(_select == 3)|(_select == 0))){_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 27:4bcdfb212467 110 else if (_set == 2 && _select == 1){_count++; _score++; music.coin(pad);}
yfkwok 27:4bcdfb212467 111 else if (_set == 3 && ((_select == 3)|(_select == 1)|(_select == 0))){_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 27:4bcdfb212467 112 else if (_set == 3 && _select == 2){_count++; _score++; music.coin(pad);}
yfkwok 27:4bcdfb212467 113 else {_count++; pad.tone(750.0,0.1); wait(0.1);}
yfkwok 27:4bcdfb212467 114 }
yfkwok 21:704d938acf5d 115 }
yfkwok 21:704d938acf5d 116
yfkwok 21:704d938acf5d 117 void Game_three::background(N5110 &lcd)
yfkwok 21:704d938acf5d 118 {
yfkwok 21:704d938acf5d 119 int data [48][84] = {
yfkwok 28:a6726a3f8e6d 120 {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 121 {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 122 {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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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:a6726a3f8e6d 166 {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 167 {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 168 };
yfkwok 21:704d938acf5d 169 lcd.drawSprite(0, 0, 48, 84, (int*) data);
yfkwok 27:4bcdfb212467 170 }
yfkwok 27:4bcdfb212467 171
yfkwok 27:4bcdfb212467 172 int Game_three::get_count()
yfkwok 27:4bcdfb212467 173 {
yfkwok 27:4bcdfb212467 174 int count = _count;
yfkwok 27:4bcdfb212467 175 return count;
yfkwok 27:4bcdfb212467 176 }
yfkwok 27:4bcdfb212467 177
yfkwok 27:4bcdfb212467 178 int Game_three::get_score()
yfkwok 27:4bcdfb212467 179 {
yfkwok 27:4bcdfb212467 180 int score = _score;
yfkwok 27:4bcdfb212467 181 return score;
yfkwok 27:4bcdfb212467 182 }
yfkwok 27:4bcdfb212467 183
yfkwok 27:4bcdfb212467 184 void Game_three::intro(Gamepad &pad, N5110 &lcd)
yfkwok 27:4bcdfb212467 185 {
yfkwok 27:4bcdfb212467 186 Page currentPage = PAGE_1;
yfkwok 27:4bcdfb212467 187 int fps = 8.0;
yfkwok 27:4bcdfb212467 188 int instruct_data[4][7] = {
yfkwok 27:4bcdfb212467 189 {1,1,1,1,1,1,1},
yfkwok 27:4bcdfb212467 190 {0,1,1,1,1,1,0},
yfkwok 27:4bcdfb212467 191 {0,0,1,1,1,0,0},
yfkwok 27:4bcdfb212467 192 {0,0,0,1,0,0,0},
yfkwok 27:4bcdfb212467 193 };
yfkwok 27:4bcdfb212467 194
yfkwok 27:4bcdfb212467 195 while(pad.check_event(Gamepad::A_PRESSED) == false){
yfkwok 27:4bcdfb212467 196 switch (currentPage) {
yfkwok 27:4bcdfb212467 197 case PAGE_1:
yfkwok 27:4bcdfb212467 198 lcd.clear();
yfkwok 27:4bcdfb212467 199 lcd.printString("Bulbasaur",0,0);
yfkwok 27:4bcdfb212467 200 lcd.printString("is trying",0,1);
yfkwok 27:4bcdfb212467 201 lcd.printString("to study!",0,2);
yfkwok 27:4bcdfb212467 202 lcd.printString("Stop texting",0,4);
yfkwok 27:4bcdfb212467 203 lcd.drawSprite(39, 44, 4, 7, (int *)instruct_data);
yfkwok 27:4bcdfb212467 204 lcd.refresh();
yfkwok 27:4bcdfb212467 205 if(pad.get_direction() == S){currentPage = PAGE_2;}
yfkwok 27:4bcdfb212467 206 wait(1.0f/fps);
yfkwok 27:4bcdfb212467 207 break;
yfkwok 27:4bcdfb212467 208 case PAGE_2:
yfkwok 27:4bcdfb212467 209 lcd.clear();
yfkwok 27:4bcdfb212467 210 lcd.printString("the girls,",0,0);
yfkwok 27:4bcdfb212467 211 lcd.printString("so he can pass",0,1);
yfkwok 27:4bcdfb212467 212 lcd.printString("the test by",0,2);
yfkwok 27:4bcdfb212467 213 lcd.printString("choosing to",0,3);
yfkwok 27:4bcdfb212467 214 lcd.printString("study!",0,4);
yfkwok 27:4bcdfb212467 215 lcd.printString("Press A",0,5);
yfkwok 27:4bcdfb212467 216 lcd.refresh();
yfkwok 27:4bcdfb212467 217 wait(1.0f/fps);
yfkwok 27:4bcdfb212467 218 break;
yfkwok 27:4bcdfb212467 219 }
yfkwok 27:4bcdfb212467 220 }
yfkwok 21:704d938acf5d 221 }