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

2018/3/25

How do I add an actor based on the score?

1
2
danpost danpost

2018/3/26

#
UnKnown89 wrote...
<< Code Omitted >> World class is above the error is on the actor class where a variable couldn't be found.
The act method given above was for your CopyOfMyWorld2 class -- not for an actor class.
UnKnown89 UnKnown89

2018/3/26

#
So I have replaced it but it still says it can't find the method getScore();
 public void scoreCheck()
{
    int score = scoreCounter.getScore();
    if (score > maxScore)
    {
        maxScore = score;
        if (maxScore == 100) addObject(new Helicopter(), 550, 500);
        if (maxScore == 500) addObject(new Tank(), 550, 375);
    }
}
UnKnown89 UnKnown89

2018/3/26

#
Thanks for you help though.
danpost danpost

2018/3/26

#
UnKnown89 wrote...
So I have replaced it but it still says it can't find the method getScore();
Oh -- you named the method as returnScore, not getScore.
UnKnown89 UnKnown89

2018/3/26

#
I know that I am very bad at greenfoot but thanks soo much it works now. Thank you very much
You need to login to post a reply.
1
2