zhangxinyu01text

Dependencies:   mbed

Revision:
19:0657c7e4d4bf
Parent:
18:a7d8b45648f4
Child:
20:5efed4030c7b
--- a/CXK/CXK.cpp	Mon May 06 06:57:21 2019 +0000
+++ b/CXK/CXK.cpp	Mon May 06 07:07:55 2019 +0000
@@ -40,7 +40,15 @@
 
     // update y value depending on direction of movement
     // North is decrement as origin is at the top-left so decreasing moves up
-    
+    if (d == N) {
+        _y-=_speed;
+    } else if (d == S) {
+        _y+=_speed;
+    } else if (d == E) {
+        _x+=_speed;
+    } else if (d == W){
+        _x-=_speed; 
+        }
 
     
     // check the y origin to ensure that the CXK doesn't go off screen
@@ -69,7 +77,3 @@
     return _score;
 }
 
-Vector2D CXK::get_pos() {
-    Vector2D p = {_x,_y};
-    return p;    
-}
\ No newline at end of file