From 381f72d2002bcfb6990aec557511058884046df8 Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Wed, 8 Feb 2023 20:44:27 +0100 Subject: [PATCH] update --- src/main/java/PingPong/GamePanel.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/PingPong/GamePanel.java b/src/main/java/PingPong/GamePanel.java index 0a9304a..c95c098 100644 --- a/src/main/java/PingPong/GamePanel.java +++ b/src/main/java/PingPong/GamePanel.java @@ -39,6 +39,10 @@ public class GamePanel extends JPanel implements Runnable { } public void checkCollision() { + //Reflection of Ball when it touches top and bottom edges! + if(collisionChecker.didTouchTopOrBottomEdge(ball.y, FRAME_HEIGHT-BALL_DIAMETER)) { + ball.setYDirection(-ball.yVelocity); + } }