ELEC2645 (2017/18) / Mbed 2 deprecated el17yw

Dependencies:   mbed

Revision:
6:46d0caedf217
Parent:
5:0a116644cce2
Child:
7:1964f649676e
--- a/rec/rect.cpp	Mon Apr 16 09:57:57 2018 +0000
+++ b/rec/rect.cpp	Tue Apr 17 20:53:43 2018 +0000
@@ -12,13 +12,13 @@
 void rect::init(int x,int y)
 {
     //rect_x = x;  // x value on screen is fixed
-    //rect_y = y;
+    //rect_y = 80;
     rect_speed = 0.7;  // default speed
 }
 
 void rect::draw(N5110 &lcd)
 {
-    lcd.drawRect(rect_x,rect_y,10,1,FILL_BLACK);
+    lcd.drawRect(rect_x,40,10,1,FILL_BLACK);
   
 }
 
@@ -26,15 +26,17 @@
 {
     
     rect_speed = int(mag*10.0f);  // scale is arbitrary, could be changed in future
-    if (d == N) {
+    /*if (d == N) {
     
-        rect_y-=rect_speed;
+        rect_y=80;
    
     } else if (d == S) {
         
-        rect_y+=rect_speed;
+        rect_y=80;
 
     }
+    */
+    
       if (d == W) {
         rect_x-=rect_speed;
     } else if (d == E) {
@@ -42,31 +44,19 @@
     }
 
     // check the y origin to ensure that the paddle doesn't go off screen
-    if (rect_y < 1) {
-        rect_y = 1;
-    }
-    if (rect_y > 44) {
-        rect_y = 44;
-    }
-
-    if (rect_x < 1) {
-        rect_x = 1;
-    }
-    if (rect_x > 80) {
-        rect_x = 80;
-    }
+   
 }
 
 
 Vector2D rect::get_pos() {
-    Vector2D p = {rect_x,rect_y};
+    Vector2D p = {rect_x};
     return p;    
 }
 
 void rect::set_pos(Vector2D p)
 {
     rect_x = p.x;
-    rect_y = p.y;
+   //rect_y = p.y;
 }