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

2016/4/29

Two Scores

GreenMan15 GreenMan15

2016/4/29

#
Hello I created two seperate score counters for each level. In my final level I want to show the total score from the previous level plus the score from the final level. But whenever I run it, it adds the score from the last level twice, is my calculation messed up in line 26?
 public MyWorld()
    {    
       
        super(1280, 720, 1); 
        time = 250;
        timer = 1000;
        score = 0;
        secondScore = 0;
        volume = 25;
    }

    public void showScore()
    {
        showText("Score: " + score, 800,20);
    }
    public void showSecondScore()
    {
        showText("Score: " + secondScore, 800,20);
    }
    public void showFirstLevelScore()
    {
        showText("Your Final Score: " + score, 640, 360);
    }
    public void showSecondLevelScore()
    {
        int total = score + secondScore;
        showText("Your Total Score: "  + total, 640, 360);
    }
danpost danpost

2016/4/29

#
GreenMan15 wrote...
Hello I created two seperate score counters for each level. In my final level I want to show the total score from the previous level plus the score from the final level. But whenever I run it, it adds the score from the last level twice, is my calculation messed up in line 26? < Code Omitted >
It is not doing it from any of the code given.
You need to login to post a reply.