filled rects, they turn now
Dependencies: 4DGL-uLCD-SE Joystick SDFileSystem mbed wave_player
Fork of 4180Lab4SimonSays by
Revision 1:cd20b1555770, committed 2017-03-09
- Comitter:
- hayden
- Date:
- Thu Mar 09 22:57:58 2017 +0000
- Parent:
- 0:aa7531dac907
- Commit message:
- It randomly goes thru different rectangles
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Mar 09 21:53:59 2017 +0000 +++ b/main.cpp Thu Mar 09 22:57:58 2017 +0000 @@ -5,7 +5,7 @@ #include "Joystick.h" -Nav_Switch myNav( p9, p6, p7, p5, p8); +Nav_Switch myNav( p9, p12, p13, p11, p10); // U, D, L, R, Fire uLCD_4DGL uLCD(p28, p27, p29); SDFileSystem sd(p5, p6, p7, p8, "sd"); //SD card @@ -31,17 +31,25 @@ for (int i = 0; i < lev; i++) { if (arrowVec[i] == 1) { + uLCD.cls(); + //uLCD.background_color(DGREY); uLCD.triangle(15, 50, 35, 45, 35, 75, RED); - uLCD.rectangle(35,50,85,70,RED); + uLCD.filled_rectangle(35,50,85,70,RED); + //wait(.2); } else if (arrowVec[i] == 2) { + uLCD.cls(); //uLCD.triangle(int x1, int y1 , int x2, int y2, int x3, int y3, RED); - uLCD.rectangle(35,50,85,70,BLUE); + uLCD.filled_rectangle(70,35,50,85,BLUE); + } else if (arrowVec[i] == 3) { + uLCD.cls(); //uLCD.triangle(); - uLCD.rectangle(35,50,85,70,GREEN); + uLCD.filled_rectangle(85,70,35,50,GREEN); } else { - uLCD.rectangle(35,50,85,70,WHITE); + uLCD.cls(); + uLCD.filled_rectangle(50,85,70,35,WHITE); } + wait(0.2); } } @@ -55,13 +63,15 @@ while(game) { level++; -// for (int i = 0; i < level; i++) { -// arrow = (rand() % 4) + 1; -// arrowVec[i] = arrow; -// } - arrowVec[0] = 1; + for (int i = 0; i < level; i++) { + arrow = (rand() % 4) + 1; + arrowVec[i] = arrow; + } + //arrowVec[0] = 1; createArrows(level); - game = false; + if(level==21){ + game = false; + } }