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

2012/7/9

Scoreboard doesn't work for me

erdelf erdelf

2012/7/9

#
So I imported the Scoreboard class, edited it a bit and then the scores was in the wrong order, I fixed it with reimporting the class, but now with the following code to add the scoreboard, I get the wrong Scores. It is my scenario Arena. I have an old code who uses the same method to get the Score but this one shows a score much higher then the score board. Here my code
        UserInfo me = UserInfo.getMyInfo();
        if (me != null)
        {
            if (getScore() > me.getScore())
            {
                // It's a high-score, only update the score if ours is now higher:
                me.setScore(getScore());
                me.store();
            }
        }
        addObject(new ScoreBoard(1000, 600), getWidth() / 2, getHeight() / 2); 
get Score looks like this:
    public int getScore()
    {
        return score;
    }
SPower SPower

2012/7/9

#
Should work, you said you edited the scoreboard class? Can you show what's edited?
nccb nccb

2012/7/9

#
The problem is that in ArenaSP, you are using the scores the way the beta did (with getInt(0)), not the way the finished version did (with getScore()). Search for getInt and setInt and ArenaSP and change all the mentions to getScore and setScore, then it works.
erdelf erdelf

2012/7/9

#
what's the difference between getScore() and getInt(0)?
nccb nccb

2012/7/9

#
Score is a separate integer to the ten integers you have (in the beta, this was not the case, and the first integer was used as the score), so getInt(0) and getScore() access different parts of the storage.
erdelf erdelf

2012/7/9

#
ok thx for that, someone told me in an earlier discussion that this was the same, seems that he meant in the beta
You need to login to post a reply.