zhangxinyu01text

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Jenny121
Date:
Mon May 06 09:33:50 2019 +0000
Parent:
23:b9b98e400e8b
Commit message:
the final WORK

Changed in this revision

cxkEngine/cxkEngine.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r b9b98e400e8b -r 8b1494a6bdbe cxkEngine/cxkEngine.cpp
--- a/cxkEngine/cxkEngine.cpp	Mon May 06 09:22:20 2019 +0000
+++ b/cxkEngine/cxkEngine.cpp	Mon May 06 09:33:50 2019 +0000
@@ -125,7 +125,12 @@
     Vector2D cxkp_pos = _cxkp.get_pos();
 
     // see if ball has hit the CXK 
-    
+    if ((ball_pos.y - cxkp_pos.y >= -5) && 
+        (ball_pos.y - cxkp_pos.y <= 5) &&
+        (ball_pos.x - cxkp_pos.x >= -5) && 
+        (ball_pos.x - cxkp_pos.x <=  5)
+         ) //right
+     {
         // if it has, change the position and reflect x,y  velocity
         ball_pos.x= ball_pos.x + 3;
         ball_pos.y = ball_pos.y + 1;