Browse Source

refactoring:

main
fdai4616 2 years ago
parent
commit
bc61cef69b
  1. 12
      src/main/java/PingPong/Paddle.java

12
src/main/java/PingPong/Paddle.java

@ -22,11 +22,19 @@ public class Paddle extends Rectangle {
} else if (id == 2) { } else if (id == 2) {
y2 = y; y2 = y;
} }
this.width = width;
this.height = height;
PaddleWidth(width);
PaddleHeight(height);
this.id = id; this.id = id;
} }
private void PaddleHeight(int height) {
this.height = height;
}
private void PaddleWidth(int width) {
this.width = width;
}
public void released(KeyEvent e) { public void released(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_W) { if (e.getKeyCode() == KeyEvent.VK_W) {

Loading…
Cancel
Save