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

2020/4/26

How do I make a highscore?

1
2
3
HairyChickens HairyChickens

2020/5/2

#
danpost wrote...
Oh my. Lines 111 and 112 in your GameWorld class put both lines of text to the same location. Change one (or both of) them to put to different locations.
That was stupid of me lol. I think the reason why I put that there was because I wanted the high score to be one. Is that possible? If not i'm happy with this.
danpost danpost

2020/5/2

#
HairyChickens wrote...
the reason why I put that there was because I wanted the high score to be one. Is that possible?
You can concatenate the two outputs with +"\n" + between them.
HairyChickens HairyChickens

2020/5/2

#
        showText("Highscore : "+high_1, 100,100);
        +"\n"+
        showText("Highscore : "+high_2, 200,200);
Like that? And if i add that can I change both high scores to appear in the same position like before? Also how to I make it appear permanently rather than showing when the game ends.
danpost danpost

2020/5/2

#
HairyChickens wrote...
        showText("Highscore : "+high_1, 100,100);
        +"\n"+
        showText("Highscore : "+high_2, 200,200);
Like that?
No. Like:
showText("Highscore P1: "+high_1+"\nHighscore P2: "+high_2, 100, 100);
danpost danpost

2020/5/2

#
HairyChickens wrote...
how to I make it appear permanently rather than showing when the game ends.
Just call showStatus from your world constructor.
HairyChickens HairyChickens

2020/5/3

#
danpost wrote...
HairyChickens wrote...
how to I make it appear permanently rather than showing when the game ends.
Just call showStatus from your world constructor.
Ok thanks for that. So it is not possible to have both numbers combined into one like Highscore: ... Where eg player 1 scores 5 and the it shows Highscore: 5 but after a new game player 2 scores 7 and it shows Highscore:7 instead of Highscore P1: 5 Highscore P2: 7
danpost danpost

2020/5/3

#
HairyChickens wrote...
So it is not possible to have both numbers combined into one like Highscore: ... Where eg player 1 scores 5 and the it shows Highscore: 5 but after a new game player 2 scores 7 and it shows Highscore:7
Sure, it is possible (I did not know that is what you meant by combining the high scores).
public void showStatus()
{
    showText("Highscore: "+Math.max(high_1, high+2), 100, 100);
}
You need to login to post a reply.
1
2
3