Browse Source

update

main
fdai4616 2 years ago
parent
commit
72ce816ac2
  1. 18
      src/main/java/PingPong/GamePanel.java
  2. 4
      src/main/java/PingPong/Paddle.java
  3. 4
      src/main/java/PingPong/Score.java
  4. BIN
      target/classes/PingPong/Ball.class
  5. BIN
      target/classes/PingPong/GamePanel.class

18
src/main/java/PingPong/GamePanel.java

@ -2,6 +2,8 @@ package PingPong;
import javax.swing.*;
import java.awt.*;
import java.util.Random;
public class GamePanel extends JPanel implements Runnable {
static final int FRAME_WIDTH = 1000;
@ -11,14 +13,30 @@ public class GamePanel extends JPanel implements Runnable {
static final int PADDLE_HEIGHT = 100;
public static final Dimension SCREEN = new Dimension(FRAME_WIDTH, FRAME_HEIGHT);
Ball ball;
Paddle paddle_1;
Paddle paddle_2;
Score score;
public void run() {
}
public void draw(Graphics g) {
score.draw(g);
paddle_1.draw(g);
paddle_2.draw(g);
ball.draw(g);
}
public void newBall() {
ball = new Ball((FRAME_WIDTH/2)-(BALL_DIAMETER/2), ((FRAME_HEIGHT/2)-(BALL_DIAMETER/2)), BALL_DIAMETER, BALL_DIAMETER);
}
}

4
src/main/java/PingPong/Paddle.java

@ -1,4 +1,8 @@
package PingPong;
import java.awt.*;
public class Paddle {
public void draw(Graphics g) {
}
}

4
src/main/java/PingPong/Score.java

@ -1,4 +1,8 @@
package PingPong;
import java.awt.*;
public class Score {
public void draw(Graphics g) {
}
}

BIN
target/classes/PingPong/Ball.class

BIN
target/classes/PingPong/GamePanel.class

Loading…
Cancel
Save