From 26493c3a9f60d8e19adf2462706baba21cbfd48c Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Wed, 8 Feb 2023 20:25:56 +0100 Subject: [PATCH] refactoring: --- src/main/java/PingPong/GamePanel.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/PingPong/GamePanel.java b/src/main/java/PingPong/GamePanel.java index 4b4db89..040cb36 100644 --- a/src/main/java/PingPong/GamePanel.java +++ b/src/main/java/PingPong/GamePanel.java @@ -4,7 +4,6 @@ import javax.swing.*; import java.awt.*; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; -import java.util.Random; public class GamePanel extends JPanel implements Runnable { @@ -27,7 +26,7 @@ public class GamePanel extends JPanel implements Runnable { public GamePanel() { - newPeddle(); + newPaddle(); newBall(); score = new Score(FRAME_WIDTH, FRAME_HEIGHT); collisionChecker = new CollisionChecker(); @@ -76,7 +75,7 @@ public class GamePanel extends JPanel implements Runnable { ball = new Ball((FRAME_WIDTH/2)-(BALL_DIAMETER/2), ((FRAME_HEIGHT/2)-(BALL_DIAMETER/2)), BALL_DIAMETER, BALL_DIAMETER); } - public void newPeddle() { + public void newPaddle() { paddle_1 = new Paddle(0, (FRAME_HEIGHT/2)-(PADDLE_HEIGHT/2), PADDLE_WIDTH, PADDLE_HEIGHT, 1 ); paddle_2 = new Paddle(FRAME_WIDTH-PADDLE_WIDTH, (FRAME_HEIGHT/2)-(PADDLE_HEIGHT/2), PADDLE_WIDTH, PADDLE_HEIGHT, 2 ); }