   breakout paddle and ball
  the following code is to have a ball bounce off the walls and and the paddle.//bounce off sidesif (ball_left<=0||ball_left>=780){x_vel=-x_vel;}//bounce off paddleif (ball_top>=paddle_top && ball_left>=paddle_left && ball_right<=paddle_right) {y_vel=-y_vel;}
  my question is the previous code correct for the collision detection.;//bounce off sidesif (ball_left<=0||ball_left>=780){// TO-DO move ball away from wall by distance of radius to avoid it sticking to the wallx_vel= *= -1;}//bounce off paddleif (ball_top>=paddle_top && ball_left>=paddle_left && ball_right<=paddle_right) {ballposY = paddle_top - ball_radius; // Stop ball getting stuck in baty_vel *= -1;};  what is  ballposY.   ;  Well, presumably there's some variable that you're adding y_vel to each frame. Something like this:ballposY += y_vel;;  If I run with this program will it work in WindowsXP. If not so quote me how to run it.Self adhesive tape;  You might also want to add some code to make sure that a collision only happens once.That is, let's say ball_left is at -20.  You switch x_vel, so it starts moving in the right direction.  However, let's say during the next frame, ball_left is -5.It's moving in the right direction, but your code will "bounce" it back the wrong way.   