|
@ -63,6 +63,14 @@ public class GamePanel extends JPanel implements Runnable { |
|
|
ball.setXDirection(-ball.xVelocity); |
|
|
ball.setXDirection(-ball.xVelocity); |
|
|
ball.setYDirection(ball.yVelocity); |
|
|
ball.setYDirection(ball.yVelocity); |
|
|
} |
|
|
} |
|
|
|
|
|
if (paddle_1.y1 <= 0) |
|
|
|
|
|
paddle_1.y1 = 0; |
|
|
|
|
|
if (paddle_1.y1 >= (FRAME_HEIGHT-PADDLE_HEIGHT)) |
|
|
|
|
|
paddle_1.y1 = FRAME_HEIGHT-PADDLE_HEIGHT; |
|
|
|
|
|
if (paddle_2.y2 <= 0) |
|
|
|
|
|
paddle_2.y2 = 0; |
|
|
|
|
|
if (paddle_2.y2 >= (FRAME_HEIGHT-PADDLE_HEIGHT)) |
|
|
|
|
|
paddle_2.y2 = FRAME_HEIGHT-PADDLE_HEIGHT; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|