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/GameOver.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 | |
fomartin | 0:75716bd37804 | 3 | GameOver::GameOver(uLCD_4DGL &uLCD, PinDetect &Button0, PinDetect &Button1, |
fomartin | 0:75716bd37804 | 4 | PinDetect &Button2, PinDetect &Button3, |
fomartin | 0:75716bd37804 | 5 | int winningPlayer) |
fomartin | 0:75716bd37804 | 6 | { |
fomartin | 0:75716bd37804 | 7 | |
fomartin | 0:75716bd37804 | 8 | uLCD.background_color(BLACK); |
fomartin | 0:75716bd37804 | 9 | |
fomartin | 0:75716bd37804 | 10 | |
fomartin | 0:75716bd37804 | 11 | uLCD.cls(); |
fomartin | 0:75716bd37804 | 12 | uLCD.textbackground_color(BLACK); |
fomartin | 0:75716bd37804 | 13 | uLCD.color(WHITE); |
fomartin | 0:75716bd37804 | 14 | uLCD.printf("\n Game Over \n"); |
fomartin | 0:75716bd37804 | 15 | |
fomartin | 1:4976bbb3376f | 16 | //display the game over screen with the winning player |
fomartin | 0:75716bd37804 | 17 | if(winningPlayer == 1) |
fomartin | 0:75716bd37804 | 18 | { |
fomartin | 0:75716bd37804 | 19 | uLCD.locate(0, 5); |
fomartin | 0:75716bd37804 | 20 | uLCD.printf("\n"); |
fomartin | 0:75716bd37804 | 21 | uLCD.printf(" PLAYER 1 WINS!! \n"); |
fomartin | 0:75716bd37804 | 22 | uLCD.printf("\n"); |
fomartin | 0:75716bd37804 | 23 | uLCD.printf(" PLAYER 2 SUCKS... \n"); |
fomartin | 0:75716bd37804 | 24 | } |
fomartin | 0:75716bd37804 | 25 | else |
fomartin | 0:75716bd37804 | 26 | { |
fomartin | 0:75716bd37804 | 27 | uLCD.printf("\n"); |
fomartin | 0:75716bd37804 | 28 | uLCD.printf(" PLAYER 2 WINS!! \n"); |
fomartin | 0:75716bd37804 | 29 | uLCD.printf("\n"); |
fomartin | 0:75716bd37804 | 30 | uLCD.printf(" PLAYER 1 SUCKS... \n"); |
fomartin | 0:75716bd37804 | 31 | } |
fomartin | 0:75716bd37804 | 32 | |
fomartin | 1:4976bbb3376f | 33 | //return after any button press |
fomartin | 0:75716bd37804 | 34 | while(Button0 && Button1 && Button2 && Button3) {} |
fomartin | 0:75716bd37804 | 35 | } |