Zhang Xin yu
/
ZhangXinyu201090208
zhangxinyu01text
Diff: cxkEngine/cxkEngine.cpp
- Revision:
- 24:8b1494a6bdbe
- Parent:
- 23:b9b98e400e8b
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;