This is the Mexican Standoff prototype made by Francisco Martin and Andrew Smith. Please refer to the following link for instructions on hardware hookup: https://developer.mbed.org/users/fomartin/notebook/mexican-standoff-reaction-game/
Dependencies: SDFileSystem mbed-rtos mbed wave_player 4DGL-uLCD-SE PinDetect
States/Gameplay.cpp@2:3c1a5079243d, 2016-03-14 (annotated)
- Committer:
- fomartin
- Date:
- Mon Mar 14 19:14:23 2016 +0000
- Revision:
- 2:3c1a5079243d
- Parent:
- 1:4976bbb3376f
Fixed bug with player 2 pressing button during X prompt.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
fomartin | 0:75716bd37804 | 1 | #include "States.h" |
fomartin | 0:75716bd37804 | 2 | #include "mbed.h" |
fomartin | 0:75716bd37804 | 3 | |
fomartin | 0:75716bd37804 | 4 | //////////////////////////////////////////////////////////////// |
fomartin | 1:4976bbb3376f | 5 | // CONSTRUCTOR |
fomartin | 0:75716bd37804 | 6 | //////////////////////////////////////////////////////////////// |
fomartin | 0:75716bd37804 | 7 | Gameplay::Gameplay(uLCD_4DGL &uLCD, int numberOfPlayers, PinDetect &P1_Left, PinDetect &P1_Right, PinDetect &P2_Left, PinDetect &P2_Right) |
fomartin | 0:75716bd37804 | 8 | { |
fomartin | 0:75716bd37804 | 9 | uLCD.background_color(LGREY); |
fomartin | 0:75716bd37804 | 10 | uLCD.cls(); |
fomartin | 0:75716bd37804 | 11 | //random seed setup |
fomartin | 0:75716bd37804 | 12 | srand(time(NULL)); |
fomartin | 0:75716bd37804 | 13 | |
fomartin | 0:75716bd37804 | 14 | numPlayers = numberOfPlayers; |
fomartin | 0:75716bd37804 | 15 | points = new int[2]; |
fomartin | 0:75716bd37804 | 16 | CPU cpu; |
fomartin | 0:75716bd37804 | 17 | |
fomartin | 1:4976bbb3376f | 18 | //LED's used to indicate which player wins each round |
fomartin | 0:75716bd37804 | 19 | DigitalOut led1(LED1); |
fomartin | 0:75716bd37804 | 20 | DigitalOut led4(LED4); |
fomartin | 0:75716bd37804 | 21 | |
fomartin | 0:75716bd37804 | 22 | //LCD setup |
fomartin | 0:75716bd37804 | 23 | uLCD.color(BLACK); |
fomartin | 0:75716bd37804 | 24 | uLCD.textbackground_color(LGREY); |
fomartin | 0:75716bd37804 | 25 | uLCD.set_font(FONT_7X8); |
fomartin | 0:75716bd37804 | 26 | |
fomartin | 0:75716bd37804 | 27 | //points setup |
fomartin | 0:75716bd37804 | 28 | resetPoints(uLCD); |
fomartin | 0:75716bd37804 | 29 | |
fomartin | 0:75716bd37804 | 30 | //it takes 5-6 seconds for guns to get drawn, but we only draw |
fomartin | 1:4976bbb3376f | 31 | //them once at the beginning of the game-- so that's okay |
fomartin | 0:75716bd37804 | 32 | drawGun(uLCD, 10, 30, true); |
fomartin | 0:75716bd37804 | 33 | drawGun(uLCD, 10, 92, true); |
fomartin | 0:75716bd37804 | 34 | |
fomartin | 0:75716bd37804 | 35 | drawGun(uLCD, 127 - 10 - 42, 30, false); |
fomartin | 0:75716bd37804 | 36 | drawGun(uLCD, 127 - 10 - 42, 92, false); |
fomartin | 0:75716bd37804 | 37 | |
fomartin | 1:4976bbb3376f | 38 | //loop until someone runs out of points |
fomartin | 0:75716bd37804 | 39 | while(getPoints(1) != 0 && getPoints(2) != 0) |
fomartin | 0:75716bd37804 | 40 | { |
fomartin | 0:75716bd37804 | 41 | //gameplay here |
fomartin | 1:4976bbb3376f | 42 | |
fomartin | 1:4976bbb3376f | 43 | //generate which prompt will be given |
fomartin | 0:75716bd37804 | 44 | Prompt prompt = (Prompt)(rand() % 4); |
fomartin | 0:75716bd37804 | 45 | |
fomartin | 1:4976bbb3376f | 46 | //display countdown |
fomartin | 1:4976bbb3376f | 47 | countdown(uLCD); |
fomartin | 1:4976bbb3376f | 48 | |
fomartin | 1:4976bbb3376f | 49 | //clear the countdown |
fomartin | 0:75716bd37804 | 50 | clearCountdown(uLCD); |
fomartin | 0:75716bd37804 | 51 | |
fomartin | 1:4976bbb3376f | 52 | //show the prompt, and listen for inputs |
fomartin | 0:75716bd37804 | 53 | if(prompt == HoldFire) |
fomartin | 0:75716bd37804 | 54 | { |
fomartin | 0:75716bd37804 | 55 | //hold fire |
fomartin | 0:75716bd37804 | 56 | displayXs(uLCD); |
fomartin | 0:75716bd37804 | 57 | |
fomartin | 0:75716bd37804 | 58 | Timer timer; |
fomartin | 0:75716bd37804 | 59 | timer.start(); |
fomartin | 0:75716bd37804 | 60 | |
fomartin | 1:4976bbb3376f | 61 | //hold fire lasts for 2 seconds |
fomartin | 1:4976bbb3376f | 62 | //if a player fires during this 2 seconds |
fomartin | 1:4976bbb3376f | 63 | //they lose a point |
fomartin | 0:75716bd37804 | 64 | while(timer.read_ms() < 2000) |
fomartin | 0:75716bd37804 | 65 | { |
fomartin | 0:75716bd37804 | 66 | if(!P1_Left || !P1_Right) |
fomartin | 0:75716bd37804 | 67 | { |
fomartin | 0:75716bd37804 | 68 | setPoints(1, getPoints(1) - 1, uLCD); |
fomartin | 0:75716bd37804 | 69 | led4 = 1; |
fomartin | 0:75716bd37804 | 70 | break; |
fomartin | 0:75716bd37804 | 71 | } |
fomartin | 0:75716bd37804 | 72 | |
fomartin | 1:4976bbb3376f | 73 | //AI will never mis-fire on hold-fire... just for simplicity's sake |
fomartin | 2:3c1a5079243d | 74 | if(numPlayers == 2 && (!P2_Left || !P2_Right)) |
fomartin | 0:75716bd37804 | 75 | { |
fomartin | 0:75716bd37804 | 76 | setPoints(2, getPoints(2) - 1, uLCD); |
fomartin | 0:75716bd37804 | 77 | led1 = 1; |
fomartin | 0:75716bd37804 | 78 | break; |
fomartin | 0:75716bd37804 | 79 | } |
fomartin | 0:75716bd37804 | 80 | } |
fomartin | 0:75716bd37804 | 81 | } |
fomartin | 0:75716bd37804 | 82 | else |
fomartin | 0:75716bd37804 | 83 | { |
fomartin | 0:75716bd37804 | 84 | if(prompt == Either) |
fomartin | 0:75716bd37804 | 85 | { |
fomartin | 0:75716bd37804 | 86 | displayCircle(uLCD); |
fomartin | 0:75716bd37804 | 87 | } |
fomartin | 0:75716bd37804 | 88 | else if(prompt == Down) |
fomartin | 0:75716bd37804 | 89 | { |
fomartin | 0:75716bd37804 | 90 | displayDownArrow(uLCD); |
fomartin | 0:75716bd37804 | 91 | } |
fomartin | 0:75716bd37804 | 92 | else if(prompt == Up) |
fomartin | 0:75716bd37804 | 93 | { |
fomartin | 0:75716bd37804 | 94 | displayUpArrow(uLCD); |
fomartin | 0:75716bd37804 | 95 | } |
fomartin | 0:75716bd37804 | 96 | |
fomartin | 0:75716bd37804 | 97 | int aiShootTime = 0; |
fomartin | 0:75716bd37804 | 98 | |
fomartin | 0:75716bd37804 | 99 | if(numPlayers == 1) |
fomartin | 0:75716bd37804 | 100 | aiShootTime = (int)(cpu.shootTime() * 1000); |
fomartin | 0:75716bd37804 | 101 | |
fomartin | 0:75716bd37804 | 102 | Timer timer; |
fomartin | 0:75716bd37804 | 103 | timer.start(); |
fomartin | 1:4976bbb3376f | 104 | |
fomartin | 1:4976bbb3376f | 105 | //these variables act as a layer of indirection between the button being pressed |
fomartin | 1:4976bbb3376f | 106 | //and the value being read by the program. This allows us to "inject" fake |
fomartin | 1:4976bbb3376f | 107 | //button presses for the AI without having to actually have a button signal |
fomartin | 1:4976bbb3376f | 108 | //be sent by the hardware |
fomartin | 0:75716bd37804 | 109 | bool p1l = false, p1r = false, p2l = false, p2r = false; |
fomartin | 0:75716bd37804 | 110 | |
fomartin | 0:75716bd37804 | 111 | //wait for button to be pressed |
fomartin | 0:75716bd37804 | 112 | while(true) |
fomartin | 0:75716bd37804 | 113 | { |
fomartin | 1:4976bbb3376f | 114 | //if the predetermined ai wait time has elapsed, input the AI's button press |
fomartin | 0:75716bd37804 | 115 | if(numPlayers == 1 && timer.read_ms() > aiShootTime) |
fomartin | 0:75716bd37804 | 116 | { |
fomartin | 0:75716bd37804 | 117 | bool aiCorrect = cpu.shootAnswer(prompt); |
fomartin | 0:75716bd37804 | 118 | |
fomartin | 0:75716bd37804 | 119 | if(prompt == Up) |
fomartin | 0:75716bd37804 | 120 | { |
fomartin | 0:75716bd37804 | 121 | if(aiCorrect) |
fomartin | 0:75716bd37804 | 122 | { |
fomartin | 0:75716bd37804 | 123 | p2r = true; |
fomartin | 0:75716bd37804 | 124 | p2l = false; |
fomartin | 0:75716bd37804 | 125 | } |
fomartin | 0:75716bd37804 | 126 | else |
fomartin | 0:75716bd37804 | 127 | { |
fomartin | 0:75716bd37804 | 128 | p2l = true; |
fomartin | 0:75716bd37804 | 129 | p2r = false; |
fomartin | 0:75716bd37804 | 130 | } |
fomartin | 0:75716bd37804 | 131 | } |
fomartin | 0:75716bd37804 | 132 | else if (prompt == Down) |
fomartin | 0:75716bd37804 | 133 | { |
fomartin | 0:75716bd37804 | 134 | if(aiCorrect) |
fomartin | 0:75716bd37804 | 135 | { |
fomartin | 0:75716bd37804 | 136 | p2l = true; |
fomartin | 0:75716bd37804 | 137 | p2r = false; |
fomartin | 0:75716bd37804 | 138 | } |
fomartin | 0:75716bd37804 | 139 | else |
fomartin | 0:75716bd37804 | 140 | { |
fomartin | 0:75716bd37804 | 141 | p2r = true; |
fomartin | 0:75716bd37804 | 142 | p2l = false; |
fomartin | 0:75716bd37804 | 143 | } |
fomartin | 0:75716bd37804 | 144 | } |
fomartin | 0:75716bd37804 | 145 | else |
fomartin | 0:75716bd37804 | 146 | { |
fomartin | 1:4976bbb3376f | 147 | //prompt = either, just press left since either one works for this prompt |
fomartin | 0:75716bd37804 | 148 | p2l = true; |
fomartin | 0:75716bd37804 | 149 | p2r = false; |
fomartin | 0:75716bd37804 | 150 | } |
fomartin | 0:75716bd37804 | 151 | |
fomartin | 0:75716bd37804 | 152 | break; |
fomartin | 0:75716bd37804 | 153 | } |
fomartin | 0:75716bd37804 | 154 | |
fomartin | 0:75716bd37804 | 155 | if(!P1_Left) |
fomartin | 0:75716bd37804 | 156 | { |
fomartin | 0:75716bd37804 | 157 | p1l = true; |
fomartin | 0:75716bd37804 | 158 | p1r = false; |
fomartin | 0:75716bd37804 | 159 | p2l = false; |
fomartin | 0:75716bd37804 | 160 | p2r = false; |
fomartin | 0:75716bd37804 | 161 | break; |
fomartin | 0:75716bd37804 | 162 | } |
fomartin | 0:75716bd37804 | 163 | |
fomartin | 0:75716bd37804 | 164 | if(!P1_Right) |
fomartin | 0:75716bd37804 | 165 | { |
fomartin | 0:75716bd37804 | 166 | p1l = false; |
fomartin | 0:75716bd37804 | 167 | p1r = true; |
fomartin | 0:75716bd37804 | 168 | p2l = false; |
fomartin | 0:75716bd37804 | 169 | p2r = false; |
fomartin | 0:75716bd37804 | 170 | break; |
fomartin | 0:75716bd37804 | 171 | } |
fomartin | 0:75716bd37804 | 172 | |
fomartin | 1:4976bbb3376f | 173 | //only read p2 buttons if its a 2 player game |
fomartin | 0:75716bd37804 | 174 | if(numPlayers == 2 && !P2_Left) |
fomartin | 0:75716bd37804 | 175 | { |
fomartin | 0:75716bd37804 | 176 | p1l = false; |
fomartin | 0:75716bd37804 | 177 | p1r = false; |
fomartin | 0:75716bd37804 | 178 | p2l = true; |
fomartin | 0:75716bd37804 | 179 | p2r = false; |
fomartin | 0:75716bd37804 | 180 | break; |
fomartin | 0:75716bd37804 | 181 | } |
fomartin | 0:75716bd37804 | 182 | |
fomartin | 0:75716bd37804 | 183 | if(numPlayers == 2 && !P2_Right) |
fomartin | 0:75716bd37804 | 184 | { |
fomartin | 0:75716bd37804 | 185 | p1l = false; |
fomartin | 0:75716bd37804 | 186 | p1r = false; |
fomartin | 0:75716bd37804 | 187 | p2l = false; |
fomartin | 0:75716bd37804 | 188 | p2r = true; |
fomartin | 0:75716bd37804 | 189 | break; |
fomartin | 0:75716bd37804 | 190 | } |
fomartin | 0:75716bd37804 | 191 | } |
fomartin | 0:75716bd37804 | 192 | |
fomartin | 1:4976bbb3376f | 193 | |
fomartin | 1:4976bbb3376f | 194 | //check the button presses against the prompt given. decrement points accordingly |
fomartin | 0:75716bd37804 | 195 | if(p1l) |
fomartin | 0:75716bd37804 | 196 | { |
fomartin | 0:75716bd37804 | 197 | if(prompt == Either || prompt == Up) |
fomartin | 0:75716bd37804 | 198 | { |
fomartin | 0:75716bd37804 | 199 | setPoints(2, getPoints(2) - 1, uLCD); |
fomartin | 0:75716bd37804 | 200 | led1 = 1; |
fomartin | 0:75716bd37804 | 201 | } |
fomartin | 0:75716bd37804 | 202 | else |
fomartin | 0:75716bd37804 | 203 | { |
fomartin | 0:75716bd37804 | 204 | setPoints(1, getPoints(1) - 1, uLCD); |
fomartin | 0:75716bd37804 | 205 | led4 = 1; |
fomartin | 0:75716bd37804 | 206 | } |
fomartin | 0:75716bd37804 | 207 | } |
fomartin | 0:75716bd37804 | 208 | else if(p1r) |
fomartin | 0:75716bd37804 | 209 | { |
fomartin | 0:75716bd37804 | 210 | if(prompt == Either || prompt == Down) |
fomartin | 0:75716bd37804 | 211 | { |
fomartin | 0:75716bd37804 | 212 | setPoints(2, getPoints(2) - 1, uLCD); |
fomartin | 0:75716bd37804 | 213 | led1 = 1; |
fomartin | 0:75716bd37804 | 214 | } |
fomartin | 0:75716bd37804 | 215 | else |
fomartin | 0:75716bd37804 | 216 | { |
fomartin | 0:75716bd37804 | 217 | setPoints(1, getPoints(1) - 1, uLCD); |
fomartin | 0:75716bd37804 | 218 | led4 = 1; |
fomartin | 0:75716bd37804 | 219 | } |
fomartin | 0:75716bd37804 | 220 | } |
fomartin | 0:75716bd37804 | 221 | else if(p2l) |
fomartin | 0:75716bd37804 | 222 | { |
fomartin | 0:75716bd37804 | 223 | if(prompt == Either || prompt == Down) |
fomartin | 0:75716bd37804 | 224 | { |
fomartin | 0:75716bd37804 | 225 | setPoints(1, getPoints(1) - 1, uLCD); |
fomartin | 0:75716bd37804 | 226 | led4 = 1; |
fomartin | 0:75716bd37804 | 227 | } |
fomartin | 0:75716bd37804 | 228 | else |
fomartin | 0:75716bd37804 | 229 | { |
fomartin | 0:75716bd37804 | 230 | setPoints(2, getPoints(2) - 1, uLCD); |
fomartin | 0:75716bd37804 | 231 | led1 = 1; |
fomartin | 0:75716bd37804 | 232 | } |
fomartin | 0:75716bd37804 | 233 | } |
fomartin | 0:75716bd37804 | 234 | else if(p2r) |
fomartin | 0:75716bd37804 | 235 | { |
fomartin | 0:75716bd37804 | 236 | if(prompt == Either || prompt == Up) |
fomartin | 0:75716bd37804 | 237 | { |
fomartin | 0:75716bd37804 | 238 | setPoints(1, getPoints(1) - 1, uLCD); |
fomartin | 0:75716bd37804 | 239 | led4 = 1; |
fomartin | 0:75716bd37804 | 240 | } |
fomartin | 0:75716bd37804 | 241 | else |
fomartin | 0:75716bd37804 | 242 | { |
fomartin | 0:75716bd37804 | 243 | setPoints(2, getPoints(2) - 1, uLCD); |
fomartin | 0:75716bd37804 | 244 | led1 = 1; |
fomartin | 0:75716bd37804 | 245 | } |
fomartin | 0:75716bd37804 | 246 | } |
fomartin | 0:75716bd37804 | 247 | } |
fomartin | 0:75716bd37804 | 248 | |
fomartin | 1:4976bbb3376f | 249 | //remove the displayed prompt. Wait 2 seconds to give the players some |
fomartin | 1:4976bbb3376f | 250 | //amount of rest time between rounds |
fomartin | 0:75716bd37804 | 251 | clearPrompt(uLCD); |
fomartin | 0:75716bd37804 | 252 | Thread::wait(2000); |
fomartin | 0:75716bd37804 | 253 | led1 = 0; |
fomartin | 0:75716bd37804 | 254 | led4 = 0; |
fomartin | 0:75716bd37804 | 255 | } |
fomartin | 0:75716bd37804 | 256 | |
fomartin | 1:4976bbb3376f | 257 | //store the winning player in a variable so the main method can create the correct GameOver screen |
fomartin | 0:75716bd37804 | 258 | if(getPoints(1) == 0) |
fomartin | 0:75716bd37804 | 259 | winningPlayer = 2; |
fomartin | 0:75716bd37804 | 260 | else |
fomartin | 0:75716bd37804 | 261 | winningPlayer = 1; |
fomartin | 0:75716bd37804 | 262 | } |
fomartin | 0:75716bd37804 | 263 | |
fomartin | 0:75716bd37804 | 264 | //////////////////////////////////////////////////////////////// |
fomartin | 0:75716bd37804 | 265 | // GET FUNCTIONS |
fomartin | 0:75716bd37804 | 266 | //////////////////////////////////////////////////////////////// |
fomartin | 0:75716bd37804 | 267 | int Gameplay::getPoints(int player) |
fomartin | 0:75716bd37804 | 268 | { |
fomartin | 0:75716bd37804 | 269 | return points[player - 1]; |
fomartin | 0:75716bd37804 | 270 | } |
fomartin | 0:75716bd37804 | 271 | |
fomartin | 0:75716bd37804 | 272 | int Gameplay::getWinningPlayer() |
fomartin | 0:75716bd37804 | 273 | { |
fomartin | 0:75716bd37804 | 274 | return winningPlayer; |
fomartin | 0:75716bd37804 | 275 | } |
fomartin | 0:75716bd37804 | 276 | |
fomartin | 0:75716bd37804 | 277 | //////////////////////////////////////////////////////////////// |
fomartin | 0:75716bd37804 | 278 | // SET FUNCTIONS |
fomartin | 0:75716bd37804 | 279 | //////////////////////////////////////////////////////////////// |
fomartin | 0:75716bd37804 | 280 | void Gameplay::resetPoints(uLCD_4DGL &uLCD) |
fomartin | 0:75716bd37804 | 281 | { |
fomartin | 0:75716bd37804 | 282 | points[0] = 5; |
fomartin | 0:75716bd37804 | 283 | points[1] = 5; |
fomartin | 0:75716bd37804 | 284 | renderScore(uLCD); |
fomartin | 0:75716bd37804 | 285 | } |
fomartin | 0:75716bd37804 | 286 | |
fomartin | 0:75716bd37804 | 287 | void Gameplay::setPoints(int player, int value, uLCD_4DGL &uLCD) |
fomartin | 0:75716bd37804 | 288 | { |
fomartin | 0:75716bd37804 | 289 | points[player - 1] = value; |
fomartin | 0:75716bd37804 | 290 | renderScore(uLCD); |
fomartin | 0:75716bd37804 | 291 | } |
fomartin | 0:75716bd37804 | 292 | |
fomartin | 0:75716bd37804 | 293 | //////////////////////////////////////////////////////////////// |
fomartin | 0:75716bd37804 | 294 | // PROTECTED FUNCTIONS |
fomartin | 0:75716bd37804 | 295 | //////////////////////////////////////////////////////////////// |
fomartin | 0:75716bd37804 | 296 | |
fomartin | 0:75716bd37804 | 297 | void Gameplay::drawGun(uLCD_4DGL &uLCD, int x, int y, bool facingRight) |
fomartin | 0:75716bd37804 | 298 | { |
fomartin | 1:4976bbb3376f | 299 | //image arrays generated using a separate Java program (for ease of operating with images) |
fomartin | 0:75716bd37804 | 300 | if(facingRight) |
fomartin | 0:75716bd37804 | 301 | { |
fomartin | 0:75716bd37804 | 302 | int colors[] = {12566463, 12566463, -16777216, -16777216, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -5023488, -5023488, -5023488, -5023488, -16777216, -16777216, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -5023488, -5023488, -5023488, -5023488, -16777216, -16777216, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -5023488, -5023488, -8372224, -8372224, -8372224, -8372224, -8372224, -8372224, -16777216, -16777216, -16777216, -16777216, 12566463, 12566463, -16777216, -16777216, 12566463, 12566463, -16777216, -16777216, -5023488, -5023488, -8372224, -8372224, -8372224, -8372224, -8372224, -8372224, -16777216, -16777216, -16777216, -16777216, 12566463, 12566463, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -16777216, -16777216, -8372224, -8372224, -8372224, -8372224, -8372224, -8372224, -8372224, -8372224, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -16777216, -16777216, -8372224, -8372224, -8372224, -8372224, -8372224, -8372224, -8372224, -8372224, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -16777216, -16777216, -8372224, -8372224, -13158601, -13158601, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -16777216, -16777216, -8372224, -8372224, -13158601, -13158601, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, 12566463, 12566463, -16777216, -16777216, -13158601, -13158601, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, 12566463, 12566463, -16777216, -16777216, -13158601, -13158601, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, 12566463, 12566463, -16777216, -16777216, -16777216, -16777216, -16777216, -16777216, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, 12566463, 12566463, -16777216, -16777216, -16777216, -16777216, -16777216, -16777216, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -13158601, -13158601, -13158601, -13158601, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -13158601, -13158601, -13158601, -13158601, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -13158601, -13158601, -13158601, -13158601, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -13158601, -13158601, -13158601, -13158601, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -13158601, -13158601, -13158601, -13158601, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -13158601, -13158601, -13158601, -13158601, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -11382190, -11382190, -11382190, -11382190, -11382190, -11382190, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -11382190, -11382190, -11382190, -11382190, -11382190, -11382190, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -16777216, -16777216, -16777216, -16777216, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -16777216, -16777216, -16777216, -16777216, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -11382190, -11382190, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -11382190, -11382190, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -11382190, -11382190, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -11382190, -11382190, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -11382190, -11382190, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -11382190, -11382190, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -11382190, -11382190, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -11382190, -11382190, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -11382190, -11382190, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -11382190, -11382190, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -11382190, -11382190, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -11382190, -11382190, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -11382190, -11382190, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -11382190, -11382190, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -13158601, -13158601, -16777216, -16777216, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -13158601, -13158601, -16777216, -16777216, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463}; |
fomartin | 0:75716bd37804 | 303 | uLCD.BLIT(x, y, 42, 20, colors); |
fomartin | 0:75716bd37804 | 304 | } |
fomartin | 0:75716bd37804 | 305 | else |
fomartin | 0:75716bd37804 | 306 | { |
fomartin | 0:75716bd37804 | 307 | int colors[] = {12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -13158601, -13158601, -16777216, -16777216, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -13158601, -13158601, -16777216, -16777216, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -11382190, -11382190, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -11382190, -11382190, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -11382190, -11382190, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -11382190, -11382190, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -11382190, -11382190, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -11382190, -11382190, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -11382190, -11382190, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -11382190, -11382190, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -11382190, -11382190, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -11382190, -11382190, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -11382190, -11382190, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -11382190, -11382190, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -11382190, -11382190, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -11382190, -11382190, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -16777216, -16777216, -16777216, -16777216, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -16777216, -16777216, -16777216, -16777216, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -11382190, -11382190, -11382190, -11382190, -11382190, -11382190, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -11382190, -11382190, -11382190, -11382190, -11382190, -11382190, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -13158601, -13158601, -13158601, -13158601, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -13158601, -13158601, -13158601, -13158601, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -13158601, -13158601, -13158601, -13158601, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -13158601, -13158601, -13158601, -13158601, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -13158601, -13158601, -13158601, -13158601, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -13158601, -13158601, -13158601, -13158601, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, 12566463, 12566463, -16777216, -16777216, -16777216, -16777216, -16777216, -16777216, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, 12566463, 12566463, -16777216, -16777216, -16777216, -16777216, -16777216, -16777216, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, 12566463, 12566463, -16777216, -16777216, -13158601, -13158601, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, 12566463, 12566463, -16777216, -16777216, -13158601, -13158601, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -16777216, -16777216, -8372224, -8372224, -13158601, -13158601, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -16777216, -16777216, -8372224, -8372224, -13158601, -13158601, -13158601, -13158601, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -16777216, -16777216, -8372224, -8372224, -8372224, -8372224, -8372224, -8372224, -8372224, -8372224, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -16777216, -16777216, -8372224, -8372224, -8372224, -8372224, -8372224, -8372224, -8372224, -8372224, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -5023488, -5023488, -8372224, -8372224, -8372224, -8372224, -8372224, -8372224, -16777216, -16777216, -16777216, -16777216, 12566463, 12566463, -16777216, -16777216, 12566463, 12566463, -16777216, -16777216, -5023488, -5023488, -8372224, -8372224, -8372224, -8372224, -8372224, -8372224, -16777216, -16777216, -16777216, -16777216, 12566463, 12566463, -16777216, -16777216, 12566463, 12566463, -16777216, -16777216, -5023488, -5023488, -5023488, -5023488, -16777216, -16777216, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -5023488, -5023488, -5023488, -5023488, -16777216, -16777216, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, -16777216, -16777216, -16777216, -16777216, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463, 12566463}; |
fomartin | 0:75716bd37804 | 308 | uLCD.BLIT(x, y, 42, 20, colors); |
fomartin | 0:75716bd37804 | 309 | } |
fomartin | 0:75716bd37804 | 310 | } |
fomartin | 0:75716bd37804 | 311 | |
fomartin | 0:75716bd37804 | 312 | void Gameplay::displayUpArrow(uLCD_4DGL &uLCD) |
fomartin | 0:75716bd37804 | 313 | { |
fomartin | 0:75716bd37804 | 314 | uLCD.line(64, 64, 64, 30, GREEN); |
fomartin | 0:75716bd37804 | 315 | uLCD.line(54, 40, 64, 30, GREEN); |
fomartin | 0:75716bd37804 | 316 | uLCD.line(74, 40, 64, 30, GREEN); |
fomartin | 0:75716bd37804 | 317 | } |
fomartin | 0:75716bd37804 | 318 | |
fomartin | 0:75716bd37804 | 319 | void Gameplay::displayDownArrow(uLCD_4DGL &uLCD) |
fomartin | 0:75716bd37804 | 320 | { |
fomartin | 0:75716bd37804 | 321 | uLCD.line(64, 64, 64, 98, GREEN); |
fomartin | 0:75716bd37804 | 322 | uLCD.line(54, 88, 64, 98, GREEN); |
fomartin | 0:75716bd37804 | 323 | uLCD.line(74, 88, 64, 98, GREEN); |
fomartin | 0:75716bd37804 | 324 | } |
fomartin | 0:75716bd37804 | 325 | |
fomartin | 0:75716bd37804 | 326 | void Gameplay::displayCircle(uLCD_4DGL &uLCD) |
fomartin | 0:75716bd37804 | 327 | { |
fomartin | 0:75716bd37804 | 328 | uLCD.circle(64, 64, 15, GREEN); |
fomartin | 0:75716bd37804 | 329 | } |
fomartin | 0:75716bd37804 | 330 | |
fomartin | 0:75716bd37804 | 331 | void Gameplay::displayXs(uLCD_4DGL &uLCD) |
fomartin | 0:75716bd37804 | 332 | { |
fomartin | 0:75716bd37804 | 333 | //top X |
fomartin | 0:75716bd37804 | 334 | uLCD.line(54, 40, 74, 20, RED); |
fomartin | 0:75716bd37804 | 335 | uLCD.line(54, 20, 74, 40, RED); |
fomartin | 0:75716bd37804 | 336 | |
fomartin | 0:75716bd37804 | 337 | //bottom X |
fomartin | 0:75716bd37804 | 338 | uLCD.line(54, 88, 74, 108, RED); |
fomartin | 0:75716bd37804 | 339 | uLCD.line(54, 108, 74, 88, RED); |
fomartin | 0:75716bd37804 | 340 | } |
fomartin | 0:75716bd37804 | 341 | |
fomartin | 0:75716bd37804 | 342 | //clears the arrow/circle/x currently on the screen |
fomartin | 0:75716bd37804 | 343 | void Gameplay::clearPrompt(uLCD_4DGL &uLCD) |
fomartin | 0:75716bd37804 | 344 | { |
fomartin | 0:75716bd37804 | 345 | //up arrow |
fomartin | 0:75716bd37804 | 346 | uLCD.line(64, 64, 64, 30, LGREY); |
fomartin | 0:75716bd37804 | 347 | uLCD.line(54, 40, 64, 30, LGREY); |
fomartin | 0:75716bd37804 | 348 | uLCD.line(74, 40, 64, 30, LGREY); |
fomartin | 0:75716bd37804 | 349 | |
fomartin | 0:75716bd37804 | 350 | //down arrow |
fomartin | 0:75716bd37804 | 351 | uLCD.line(64, 64, 64, 98, LGREY); |
fomartin | 0:75716bd37804 | 352 | uLCD.line(54, 88, 64, 98, LGREY); |
fomartin | 0:75716bd37804 | 353 | uLCD.line(74, 88, 64, 98, LGREY); |
fomartin | 0:75716bd37804 | 354 | |
fomartin | 0:75716bd37804 | 355 | //circle |
fomartin | 0:75716bd37804 | 356 | uLCD.circle(64, 64, 15, LGREY); |
fomartin | 0:75716bd37804 | 357 | |
fomartin | 0:75716bd37804 | 358 | //top X |
fomartin | 0:75716bd37804 | 359 | uLCD.line(54, 40, 74, 20, LGREY); |
fomartin | 0:75716bd37804 | 360 | uLCD.line(54, 20, 74, 40, LGREY); |
fomartin | 0:75716bd37804 | 361 | |
fomartin | 0:75716bd37804 | 362 | //bottom X |
fomartin | 0:75716bd37804 | 363 | uLCD.line(54, 88, 74, 108, LGREY); |
fomartin | 0:75716bd37804 | 364 | uLCD.line(54, 108, 74, 88, LGREY); |
fomartin | 0:75716bd37804 | 365 | } |
fomartin | 0:75716bd37804 | 366 | |
fomartin | 1:4976bbb3376f | 367 | //Displays 3..2..1.. on screen |
fomartin | 0:75716bd37804 | 368 | void Gameplay::countdown(uLCD_4DGL &uLCD) |
fomartin | 0:75716bd37804 | 369 | { |
fomartin | 0:75716bd37804 | 370 | uLCD.locate(5, 8); |
fomartin | 0:75716bd37804 | 371 | uLCD.printf("3"); |
fomartin | 0:75716bd37804 | 372 | Thread::wait(333); |
fomartin | 0:75716bd37804 | 373 | uLCD.printf("."); |
fomartin | 0:75716bd37804 | 374 | Thread::wait(333); |
fomartin | 0:75716bd37804 | 375 | uLCD.printf("."); |
fomartin | 0:75716bd37804 | 376 | Thread::wait(333); |
fomartin | 0:75716bd37804 | 377 | uLCD.printf("2"); |
fomartin | 0:75716bd37804 | 378 | Thread::wait(333); |
fomartin | 0:75716bd37804 | 379 | uLCD.printf("."); |
fomartin | 0:75716bd37804 | 380 | Thread::wait(333); |
fomartin | 0:75716bd37804 | 381 | uLCD.printf("."); |
fomartin | 0:75716bd37804 | 382 | Thread::wait(333); |
fomartin | 0:75716bd37804 | 383 | uLCD.printf("1"); |
fomartin | 0:75716bd37804 | 384 | Thread::wait(333); |
fomartin | 0:75716bd37804 | 385 | uLCD.printf("."); |
fomartin | 0:75716bd37804 | 386 | Thread::wait(333); |
fomartin | 0:75716bd37804 | 387 | uLCD.printf("."); |
fomartin | 0:75716bd37804 | 388 | Thread::wait(333); |
fomartin | 0:75716bd37804 | 389 | } |
fomartin | 0:75716bd37804 | 390 | |
fomartin | 1:4976bbb3376f | 391 | //clears the 3..2..1.. display |
fomartin | 0:75716bd37804 | 392 | void Gameplay::clearCountdown(uLCD_4DGL &uLCD) |
fomartin | 0:75716bd37804 | 393 | { |
fomartin | 0:75716bd37804 | 394 | uLCD.filled_rectangle(30, 50, 98, 78, LGREY); |
fomartin | 0:75716bd37804 | 395 | } |
fomartin | 0:75716bd37804 | 396 | |
fomartin | 1:4976bbb3376f | 397 | //re-draws the score on the screen |
fomartin | 0:75716bd37804 | 398 | void Gameplay::renderScore(uLCD_4DGL &uLCD) |
fomartin | 0:75716bd37804 | 399 | { |
fomartin | 0:75716bd37804 | 400 | uLCD.locate(3, 0); |
fomartin | 0:75716bd37804 | 401 | uLCD.printf("P1: %d", getPoints(1)); |
fomartin | 0:75716bd37804 | 402 | |
fomartin | 0:75716bd37804 | 403 | uLCD.locate(10, 0); |
fomartin | 0:75716bd37804 | 404 | uLCD.printf("P2: %d", getPoints(2)); |
fomartin | 0:75716bd37804 | 405 | } |