Something is going on here that I don't understand. The ball disappears when it hits a wall. The live counter seems to be working because the game is done after 3 tries even though the ball is not disappearing off the bottom of the window. Also below this section of code is the code to move the paddle, which is also working.
while (lives > 0 && bricks > 0)
double xVelocity = drand48();
double yVelocity = drand48();
move(ball, xVelocity, yVelocity);
if ((getX(ball) <= 0) || (getX(ball) + getWidth(ball) >= getWidth(window)))
{
xVelocity *= -1;
}
if (getY(ball) <= 0)
{
yVelocity *= -1;
}
if (getY(ball) + getHeight(ball) >= getHeight(window))
{
lives -= 1;
setLocation(ball, WIDTH / 2, HEIGHT / 2);
waitForClick();
}
pause(1);