This site requires JavaScript, please enable it in your browser!
Greenfoot back
MR.UWU
MR.UWU wrote ...

2022/6/5

help to make a score list

MR.UWU MR.UWU

2022/6/5

#
What I want for my game is to create a score list, that is, when the player loses on the game over screen, a list appears with his man and current score and when the player restarts the world, continue with his current score and when the player overcomes it, it restarts. this is the method i am using to capture the currency. private void catch_monedas() { if(isTouching(Monedas.class)) { removeTouching(Monedas.class); Greenfoot.playSound("Win.wav"); score++; updateScore(); } }
danpost danpost

2022/6/6

#
MR.UWU wrote...
What I want for my game is to create a score list, that is, when the player loses on the game over screen, a list appears with his man and current score and when the player restarts the world, continue with his current score and when the player overcomes it, it restarts.
It is difficult to understand what you want. I presume English is not your native language. Saying "list" would mean more than one score, but it appears you only want one. Also, at the end you say "it restarts". If you mean the score restarts, it would not make sense for the score to revert back to zero. Otherwise, I don't know what "it" refers to.
MR.UWU MR.UWU

2022/6/6

#
well, to begin with, I don't know how to speak English, I only use the translator to translate it so that you can understand me and the last thing, what you have understood is what you needed
MR.UWU MR.UWU

2022/6/6

#
basically that's what he just told me that's what he needed
danpost danpost

2022/6/6

#
MR.UWU wrote...
What I want for my game is to create a score list, that is, when the player loses on the game over screen, a list appears with his man and current score and when the player restarts the world, continue with his current score and when the player overcomes it, it restarts.
You will need two static fields -- one for final game score and one for overall high score:
public static int highScore, finalScore;
These can be in your either your game world or in the game over world. The finalScore field must be set to the game score when the game ends; The game over world can then (in its constructor) match the highScore field to the finalScore field if the finalScore value exceeds that of the highScore value.
MR.UWU MR.UWU

2022/6/7

#
ok
You need to login to post a reply.