Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 11:80e9477d9330, committed 2018-05-05
- Comitter:
- ahmedhedait
- Date:
- Sat May 05 21:10:27 2018 +0000
- Parent:
- 10:f64c56a96ddc
- Child:
- 12:48e30c78ed26
- Commit message:
- Finished with the code of the vertical lines ;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sat May 05 19:34:26 2018 +0000
+++ b/main.cpp Sat May 05 21:10:27 2018 +0000
@@ -71,7 +71,7 @@
lcd.setPixel(64,44,false); // i took reduced some pixels from the right bottom so that to open a small hole for the ball to pass through.
- printf("X = %f Y = %f\n", circx, circy);
+ //printf("X = %f Y = %f\n", circx, circy);
lcd.drawCircle(circx,circy,2,FILL_BLACK);
// keep ball on screen
@@ -122,28 +122,59 @@
//test 3
//lcd.drawRect(10,0,1,39,FILL_BLACK);
//lcd.drawRect(18,32,1,15,FILL_BLACK);
+ //lcd.drawRect(18,25,18,1,FILL_BLACK);
+ //lcd.drawRect(36,25,1,25,FILL_BLACK);
+ //lcd.drawRect(45,18,1,30,FILL_BLACK);
- for (int i = 0; i <= 2; i++) {
- printf(" Stage %d\n", i);
+ for (int i = 0; i <= 5; i++) {
+ //printf(" Stage %d\n", i);
+
if(i == 0) {
a = 10;
b = 0;
c = 1;
d = 39;
+
} else if (i == 1) {
a = 18;
b = 32;
c = 1;
d = 15;
- }
- printf("A = %d B = %d\n", a, b);
+ }
+
+ else if (i == 2) {
+ a = 36;
+ b = 25;
+ c = 1;
+ d = 25;
+ }
+
+ else if(i == 3) {
+ a = 45;
+ b = 0;
+ c = 1;
+ d = 11;
+ }
+
+ else if (i == 4) {
+ a = 45;
+ b = 18;
+ c = 1;
+ d = 30;
+ }
+
+ else if (i == 5) {
+ a = 55;
+ b = 6;
+ c = 1;
+ d = 45;
+ }
if (
(circy >= b - 2) && //top
- (circy <= 2 + b + d) && //bottom
+ (circy <= 1 + b + d) && //bottom
(circx >= a - 2) && //left
(circx <= a + 2) //right
) {
- printf("ahh");
//left
if (circx <= a - 2) {
if(circx >= a - 3) {
@@ -157,20 +188,25 @@
circx = a + 3;
}
}
-
+
//top
if(circy <= b - 2) {
if(circy >= b - 3)
circy = b - 3;
}
-
+
//bottom
if(circy >= b + d) {
- if(circy <= 1 + b + d)
- (circy = 1 + b + d);
+ if(circy <= 2 + b + d)
+ (circy = 2 + b + d);
}
}
}
+
+
+
+
+
//test 4
//lcd.drawRect(10,0,1,39,FILL_BLACK);
//lcd.drawRect(18,32,1,15,FILL_BLACK);
@@ -210,23 +246,23 @@
}
}*/
- /*
- if (circy == 41) {
- if (circx > WIDTH) {
- circx = WIDTH;
- }
- } else if (circx > 61) {
- circx = 61; // code for the ball to pass through the opening
- }
- */
+ if (circy == 41) {
+ if (circx > WIDTH) {
+ circx = WIDTH;
+ }
+ } else if (circx > 61) {
+ circx = 61; // code for the ball to pass through the opening
+ }
+
+
if (circx > 63 & circy == 41) {
lcd.printString(" EndGame ",3,2);
}
- wait(1/10);
+ wait(.05);
lcd.refresh();
}
}
\ No newline at end of file