Ahmed Hedait / Mbed 2 deprecated el16ah

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
ahmedhedait
Date:
Mon Apr 30 21:02:35 2018 +0000
Parent:
8:346c234fef94
Child:
10:f64c56a96ddc
Commit message:
I have done with the drawing of the maze. Its very basic i believe.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Mon Apr 30 17:15:20 2018 +0000
+++ b/main.cpp	Mon Apr 30 21:02:35 2018 +0000
@@ -49,9 +49,20 @@
 
         lcd.printString("           scr",0,0);
         lcd.drawRect(0,0,65,48,FILL_TRANSPARENT);
-        lcd.drawRect(10,0,2,10,FILL_BLACK); // first rectangle next to the ball
-        lcd.drawRect(10,10,15,2,FILL_BLACK);
+        lcd.drawRect(10,0,1,39,FILL_BLACK); // first rectangle next to the ball
+        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);
+        lcd.drawRect(18,18,27,1,FILL_BLACK);
+        lcd.drawRect(18,10,27,1,FILL_BLACK);
+        lcd.drawRect(45,0,1,11,FILL_BLACK);
+        lcd.drawRect(55,6,1,45,FILL_BLACK); // i finished drawing the very basic simple maze.
+
+        /*lcd.drawRect(10,10,15,2,FILL_BLACK);
         lcd.drawRect(25,0,2,12,FILL_BLACK);
+        lcd.drawRect(35,8,2,6,FILL_BLACK);
+        lcd.drawRect(35,6,18,2,FILL_BLACK);*/
 
         lcd.setPixel(64,39,false);
         lcd.setPixel(64,40,false);
@@ -74,23 +85,45 @@
         if (circx < 3) {
             circx = 3;
         }
-        
-          if ( 10 > circx | circx > 27) {
+
+
+        if (circy <= 27) {
+            if (circx > WIDTH) {
+                circx = WIDTH;
+            }
+        } else if (circx > 15) {
+            circx = 15;
+        }
+
+
+        if (circy > 40 & circy < 45) {
+            if (circx > WIDTH) {
+                circx = WIDTH;
+            }
+        } else if (circx > 7) {
+            circx = 7;
+        }                               // code for the 1st rectangle
+
+
+
+        /*if ( 10 > circx | circx > 27) {
             if (circy > HEIGHT) {
                 circy = HEIGHT;
             }
         } else if (circy < 14) {
             circy = 14;
-        }
-        
+        }                               // code for the 2nd rectangle
+
 
-        if (circy > 10) {
+
+        if (circy > 10 | circy < 6){
             if (circx > WIDTH) {
                 circx = WIDTH;
             }
-        } else if (circx > 7) {
-            circx = 7;
-        }
+        } else if (circx < 29) {
+            circx = 29;
+        }                               // code for the 1st rectangle
+
 
         if (circy == 41) {
             if (circx > WIDTH) {
@@ -98,13 +131,10 @@
             }
         } else if (circx > 61) {
             circx = 61;
-        }
+        }                */               // code for the ball to pass through the opening
 
 
 
-        /*if ( circx > 7 ) {
-        circx = 7; }*/
-
         if (circx > 63 & circy == 41) {
             lcd.printString("  EndGame ",3,2);
         }