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

2017/5/16

Highscore

DustTerminator DustTerminator

2017/5/16

#
Hello! I have a problem with a game. How do I make a highscore variable that will keep the values of the greatest score even if i press restart?
danpost danpost

2017/5/16

#
You can use a 'static' field to hold the best score during each session (from compile to compiler, or loading to loading).. Resetting does not re-initialize static fields.
DustTerminator DustTerminator

2017/5/16

#
Can you give me an exmaple please. Shoul i use the public static int form? or how?
danpost danpost

2017/5/16

#
DustTerminator wrote...
Shoul i use the public static int form?
Yes.
You need to login to post a reply.