Ahmed Hedait / Mbed 2 deprecated el16ah

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
ahmedhedait
Date:
Mon Apr 30 17:15:20 2018 +0000
Parent:
7:c5c735f76d8a
Child:
9:0f3c1b0d053f
Commit message:
I added simple rectangles to start the drawing of the maze, and did a code as well that will not let the ball overlap the walls of the maze.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Mon Apr 30 03:57:01 2018 +0000
+++ b/main.cpp	Mon Apr 30 17:15:20 2018 +0000
@@ -49,8 +49,10 @@
 
         lcd.printString("           scr",0,0);
         lcd.drawRect(0,0,65,48,FILL_TRANSPARENT);
-        lcd.drawRect(10,0,2,15,FILL_BLACK);
-        
+        lcd.drawRect(10,0,2,10,FILL_BLACK); // first rectangle next to the ball
+        lcd.drawRect(10,10,15,2,FILL_BLACK);
+        lcd.drawRect(25,0,2,12,FILL_BLACK);
+
         lcd.setPixel(64,39,false);
         lcd.setPixel(64,40,false);
         lcd.setPixel(64,41,false);
@@ -72,7 +74,23 @@
         if (circx < 3) {
             circx = 3;
         }
+        
+          if ( 10 > circx | circx > 27) {
+            if (circy > HEIGHT) {
+                circy = HEIGHT;
+            }
+        } else if (circy < 14) {
+            circy = 14;
+        }
+        
 
+        if (circy > 10) {
+            if (circx > WIDTH) {
+                circx = WIDTH;
+            }
+        } else if (circx > 7) {
+            circx = 7;
+        }
 
         if (circy == 41) {
             if (circx > WIDTH) {
@@ -82,6 +100,11 @@
             circx = 61;
         }
 
+
+
+        /*if ( circx > 7 ) {
+        circx = 7; }*/
+
         if (circx > 63 & circy == 41) {
             lcd.printString("  EndGame ",3,2);
         }