From 3ecee36fd2b953b009c51cf0de022158dabaf593 Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Tue, 7 Feb 2023 23:38:17 +0100 Subject: [PATCH] update --- src/main/java/PingPong/Paddle.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/PingPong/Paddle.java b/src/main/java/PingPong/Paddle.java index 3131276..4135fd9 100644 --- a/src/main/java/PingPong/Paddle.java +++ b/src/main/java/PingPong/Paddle.java @@ -3,10 +3,12 @@ package PingPong; import java.awt.*; import java.awt.event.KeyEvent; -public class Paddle extends Rectangle{ +public class Paddle extends Rectangle { int y1; int y2; int id; + int yVelocity1; + int yVelocity2; Paddle(int x, int y, int width, int height, int id) { //super(x, y, width, height); @@ -20,7 +22,9 @@ public class Paddle extends Rectangle{ this.height = height; this.id = id; } + public void pressed(KeyEvent e) { + } public void released(KeyEvent e) { @@ -28,4 +32,12 @@ public class Paddle extends Rectangle{ public void move() { } + + public void setYDirection(int yDirection, int paddleId) { + if (paddleId == 1) { + yVelocity1 = yDirection; + } else if (paddleId == 2) { + yVelocity2 = yDirection; + } + } }