ELEC2645 (2017/18) / Mbed 2 deprecated el17yw

Dependencies:   mbed

Revision:
7:1964f649676e
Parent:
6:46d0caedf217
Child:
9:d217a636c18d
--- a/rec/rect.cpp	Tue Apr 17 20:53:43 2018 +0000
+++ b/rec/rect.cpp	Tue Apr 17 23:03:03 2018 +0000
@@ -11,13 +11,13 @@
 }
 void rect::init(int x,int y)
 {
-    //rect_x = x;  // x value on screen is fixed
-    //rect_y = 80;
+    //set the rect move speed
     rect_speed = 0.7;  // default speed
 }
 
 void rect::draw(N5110 &lcd)
 {
+    //draw rect om the screen
     lcd.drawRect(rect_x,40,10,1,FILL_BLACK);
   
 }
@@ -25,26 +25,15 @@
 void rect::update(Direction d,float mag)
 {
     
-    rect_speed = int(mag*10.0f);  // scale is arbitrary, could be changed in future
-    /*if (d == N) {
+    rect_speed = int(mag*10.0f);  // scale is arbitrary
     
-        rect_y=80;
-   
-    } else if (d == S) {
-        
-        rect_y=80;
-
-    }
-    */
-    
+    //control the movement of rect when joystick moves
+    //movement of north and south are not allowed
       if (d == W) {
         rect_x-=rect_speed;
     } else if (d == E) {
         rect_x+=rect_speed;
     }
-
-    // check the y origin to ensure that the paddle doesn't go off screen
-   
 }