ELEC2645 (2018/19) / Mbed 2 deprecated el17yfk

Dependencies:   mbed FXOS8700CQ mbed-rtos

Committer:
yfkwok
Date:
Mon May 06 01:28:50 2019 +0000
Revision:
27:4bcdfb212467
Parent:
26:c60becf3f840
Child:
28:a6726a3f8e6d
06/05/2019 - Game 3 beta

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