Hi…
Im making this Mario Brother’s dtyle game and im looking to add a high score board at the end of each game.
I want it to appear on top of the graphics in the main screen.
Anyone has any documentation or ideeas on how it could be done?
Cheers
Hi…
Im making this Mario Brother’s dtyle game and im looking to add a high score board at the end of each game.
I want it to appear on top of the graphics in the main screen.
Anyone has any documentation or ideeas on how it could be done?
Cheers
what are you using to render your graphics java2d, opengl or something else?
Typically such things are done in games by using the same render engine yo uuse for your “sprites”. The Scorebaord is a big sprite, and each digit is a ‘sprite’ on top of it.
Alternately, you could draw the scoreboard offline into an offscreen buffer and display the whole thinsgas one sprite within your engine.
Im using java 2d
you could do it by communicating with a php script writing to a flat text file. Ill post sample code if u want.
I actually made a networked Mario back in the day. 8)
Here was my method for drawing the score on the top of the screen. Is this what you were looking for?
private void drawScore(Graphics g)
{
g.setColor(Color.WHITE);
g.setFont(new Font("Courier New", Font.BOLD, 22));
g.drawString("MARIO", 10 + getWidth()/4 * 0, 22);
g.drawString("COINS", 10 + getWidth()/4 * 1, 22);
g.drawString("WORLD", 10 + getWidth()/4 * 2, 22);
g.drawString("TIME" , 10 + getWidth()/4 * 3, 22);
g.drawString(" " + mario.score(), 10 + getWidth()/4 * 0, 40);
g.drawString(" " + mario.coins(), 10 + getWidth()/4 * 1, 40);
g.drawString(" " + level.toString(), 10 + getWidth()/4 * 2, 40);
g.drawString(" " + level.timeLeft(), 10 + getWidth()/4 * 3, 40);
}