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

2015/12/5

GreenfootImage doesn't do anything

polypoly polypoly

2015/12/5

#
I have the code bellow in my world class constructor. It should fill the screen with black but it doesn't do anything. it compiles fine but instead it just loads the image I assigned manually to the class. Am I missing something that needs to happen for it to actually go onto the screen?
        GreenfootImage bg = new GreenfootImage(getWidth(), getHeight());
        bg.setColor(Color.black);
        bg.fill();
        
        GreenfootImage img = new GreenfootImage("Hello World", 36, Color.white, Color.black);
        bg.drawImage(img, (bg.getWidth() / 2, 50);
Super_Hippo Super_Hippo

2015/12/5

#
Add this line at the end:
setBackground(bg);
You need to login to post a reply.