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); + } }