ELEC2645 (2018/19) / Mbed 2 deprecated el17mtu_

Dependencies:   mbed

Revision:
1:44f4594eacac
Parent:
0:15b74f0f8c7f
Child:
2:6ee8616695d1
--- a/ModeA/ModeA.cpp	Wed May 08 14:50:07 2019 +0000
+++ b/ModeA/ModeA.cpp	Wed May 08 15:03:25 2019 +0000
@@ -25,6 +25,12 @@
  y_position = 18;
     speed = 0;
     gravity = 1;
+    
+    screen_width = 50;
+    bar_width = 10;
+    bar_speed = 4;
+    size_top = rand() % 48;
+    size_bottom = rand() % 48;
      }
  
    
@@ -34,7 +40,8 @@
    
   
     lcd.drawRect(x_position, y_position,6,6,FILL_BLACK);
-     lcd.drawRect(10,5,7,7,FILL_BLACK);
+     lcd.drawRect(screen_width,0,bar_width,size_top,FILL_BLACK);
+     lcd.drawRect(screen_width,48-size_bottom,bar_width,size_bottom,FILL_BLACK);
     lcd.refresh();
     
 
@@ -59,6 +66,7 @@
         y_position = y_position + speed;
         wait(0.1);
       
+      screen_width = screen_width - bar_speed;
     
     }