scoreboard.setForeground(Color.YELLOW);
scoreboard.setBounds(20, 20, 200, 30); // Adjust the position and size as needed
scoreboard.setText("Score: " + score1 + " - " + score2);
scoreboard.setVisible(true);
scoreboard.setFont(scoreboard.getFont().deriveFont(30.0f));
arena.add(scoreboard); // Add the scoreboard label to the arena panel```
#Struggling to add a score counter to my game
1 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @high pasture! Please use
/closeor theClose Postbutton above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
Heres my games arena class
Heres my main class
I've been at this for a while and i'm struggling to find a way to add a score counter to this
*i just want a line of text nothing fancy
i can give you an idea >:)
not really experienced with swing but it should have these things
if(ball.getYposition=>topOfGoal){if(ball.getYposition=<buttomOfGoal){Goals=Goals+1;}}
big wow idea that you didn't think about
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.
I have collisions with goals working correctly im just trying to display a simple scoreboard on the screen