Ahmed Hedait / Mbed 2 deprecated el16ah

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
ahmedhedait
Date:
Mon May 07 18:49:57 2018 +0000
Parent:
13:98489418ac30
Child:
15:03074b766973
Commit message:
I thought of erasing the score and draw a bigger maze in which makes more sense. About the score i could not figure out a way in which i could display the score on the other side of the nokia screen since its too small to display it.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Mon May 07 17:35:34 2018 +0000
+++ b/main.cpp	Mon May 07 18:49:57 2018 +0000
@@ -60,8 +60,8 @@
 
 
         // drawing maze
-        lcd.printString("           scr",0,0);
-        lcd.drawRect(0,0,65,48,FILL_TRANSPARENT);
+        //lcd.printString("           scr",0,0);
+        lcd.drawRect(0,0,84,48,FILL_TRANSPARENT); // orig ws 65
         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);
@@ -71,13 +71,26 @@
         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(64,0,1,20,FILL_BLACK);
+         lcd.drawRect(64,27,1,13,FILL_BLACK);
+          lcd.drawRect(72,10,1,30,FILL_BLACK);
+          
+           lcd.drawRect(64,40,20,1,FILL_BLACK);
+        
+        
+        
+        
+        
+        
 
-        lcd.setPixel(64,39,false);
-        lcd.setPixel(64,40,false);
-        lcd.setPixel(64,41,false);
-        lcd.setPixel(64,42,false);
-        lcd.setPixel(64,43,false);
-        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.
+        lcd.setPixel(83,24,false);
+        lcd.setPixel(83,25,false);
+        lcd.setPixel(83,26,false);
+        lcd.setPixel(83,27,false);
+        lcd.setPixel(83,28,false);
+        lcd.setPixel(83,29,false);
+        lcd.setPixel(83,30,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);
@@ -101,8 +114,11 @@
         //lcd.drawRect(18,32,1,15,FILL_BLACK);
         //lcd.drawRect(36,25,1,25,FILL_BLACK);
         //lcd.drawRect(45,18,1,30,FILL_BLACK);
+        //lcd.drawRect(64,0,1,20,FILL_BLACK);
+         //lcd.drawRect(64,27,1,13,FILL_BLACK);
+          //lcd.drawRect(72,10,1,30,FILL_BLACK);
 
-        for (int i = 0; i <= 5; i++) {
+        for (int i = 0; i <= 8; i++) {
             //printf(" Stage  %d\n", i);
 
             if(i == 0) {
@@ -145,6 +161,28 @@
                 c = 1;
                 d = 45;
             }
+            
+            else if (i == 6) {
+                a = 64;
+                b = 0;
+                c = 1;
+                d = 20;              
+            }
+            
+            else if (i == 7) {
+                a = 64;
+                b = 27;
+                c = 1;
+                d = 13;
+            }
+            
+            else if (i == 8) {
+                a = 72;
+                b = 10;
+                c = 1;
+                d = 30;
+            }
+
 
             if (
                 (circy >= b - 2) && //top
@@ -184,8 +222,9 @@
 //lcd.drawRect(18,25,18,1,FILL_BLACK);
 // lcd.drawRect(18,18,27,1,FILL_BLACK);
 // lcd.drawRect(18,10,27,1,FILL_BLACK);
+// lcd.drawRect(64,40,20,1,FILL_BLACK);
 
-        for (int i = 0; i <= 2; i++) {
+        for (int i = 0; i <= 3; i++) {
             //printf(" Stage  %d\n", i);
 
             if(i == 0) {
@@ -206,6 +245,13 @@
                 c = 27;
                 d = 1;
             }
+            
+            else if (i == 3) {
+                a = 64;
+                b = 40;
+                c = 20;
+                d = 1;
+            }
 
             if (
                 (circy >= b - 2) && //top
@@ -234,28 +280,29 @@
                     if(circy >= b - 3)
                         circy = b - 3;
                 }
+                
 
                 //bottom
                 if(circy >= b ) {
-                    if(circy <= 3 + b )
-                        (circy = 3 + b );
+                    if(circy <= 4 + b )
+                        (circy = 4 + b );
                 }
             }
         }
 
 
 
-        if (circy == 41) {
+        if (circy == 27) {
             if (circx > WIDTH) {
                 circx = WIDTH;
             }
-        } else if (circx > 61) {
-            circx = 61; // code for the ball to pass through the opening
+        } else if (circx > 80) {
+            circx = 80; // code for the ball to pass through the opening
         }
 
 
 
-        if (circx > 63 & circy == 41) {
+        if (circx > 83 & circy == 27) {
             lcd.clear(); 
             lcd.printString("  Bravo!  ",3,2);