From 9bcb52aa765944c47bc746996a3dbd21141bdfd2 Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Tue, 7 Feb 2023 23:29:38 +0100 Subject: [PATCH] update --- src/main/java/PingPong/Score.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/PingPong/Score.java b/src/main/java/PingPong/Score.java index b364a50..6956bae 100644 --- a/src/main/java/PingPong/Score.java +++ b/src/main/java/PingPong/Score.java @@ -2,7 +2,21 @@ package PingPong; import java.awt.*; -public class Score { +public class Score extends Rectangle { + static int FRAME_WIDTH; + static int FRAME_HEIGHT; + public final int COURT_CIRCLE = 150; + public final int CENTER_DOT = 10; + int player_1; + int player_2; public void draw(Graphics g) { + g.setColor(Color.white); + g.setFont(new Font("Consolas", Font.BOLD,50)); + g.drawLine(FRAME_WIDTH/2, 0, FRAME_WIDTH/2, FRAME_HEIGHT); + g.drawOval((FRAME_WIDTH/2)-(COURT_CIRCLE/2), (FRAME_HEIGHT/2) - (COURT_CIRCLE/2), COURT_CIRCLE,COURT_CIRCLE); + g.fillOval((FRAME_WIDTH/2)-(CENTER_DOT/2), (FRAME_HEIGHT/2) - (CENTER_DOT/2), CENTER_DOT,CENTER_DOT); + g.drawString(String.valueOf(player_1/10) + String.valueOf(player_1%10), (FRAME_WIDTH/2)- 75, 50); + g.drawString(String.valueOf(player_2/10) + String.valueOf(player_2%10), (FRAME_WIDTH/2)+ 20, 50); + } }