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

2014/5/25

Message on World Error

ariaco ariaco

2014/5/25

#
In my World Class:
private int wrong;
private int correct;
private void endCount() 
    {
        clear();
        int total = wrong+correct;
        GreenfootImage score = new GreenfootImage(100,20);
        score.drawString("Your score is:" + correct + "out of" + total,2,20);
        setImage(score);  
    }
When I try to compile "setImage(score);" is highlighted with error message "cannot find symbol"
ariaco ariaco

2014/5/25

#
Could someone show me how to fix this error?
danpost danpost

2014/5/25

#
First, what kind of class is this code in (World, Actor, or other0? Then, "cannot find symbol" ... -- which symbol does it say it cannot find?
ariaco ariaco

2014/5/25

#
1) World class 2) cannot find symbol- method setImage(greenfoot.GreenfootImage)
davmac davmac

2014/5/25

#
ariaco, if you check the documentation for the World class you will see that it has no "setImage" method (Actor has that method, but World does not). You probably wanted to use the "setBackground" method.
ariaco ariaco

2014/5/25

#
Ahh I see. Thank you!
You need to login to post a reply.