trouble understanding collision detection code
I am trying to decipherandre lamothe's freakout demo but im not getting this snippet of code
Code:
// test of the ball has hit the paddle
if (ball_y > (SCREEN_HEIGHT/2) && ball_dy > 0)
{
// extract leading edge of ball
int x = ball_x+(BALL_SIZE/2);
int y = ball_y+(BALL_SIZE/2);
// test for collision with paddle
if ((x >= paddle_x && x <= paddle_x+PADDLE_WIDTH) &&
(y >= paddle_y && y <= paddle_y+PADDLE_HEIGHT))
{
// reflect ball
ball_dy=-ball_dy;
// push ball out of paddle since it made contact
ball_y+=ball_dy;
I am referring to the test for collision with the paddle. I don't understand how x can be greater than paddle_x and less than paddle_x + PADDLE_WIDTH at the same time. PADDLE_X is 32. Help!!!!!!