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

2013/10/22

Broken Code?

Y3llowMustang Y3llowMustang

2013/10/22

#
private void submerge()
    {
        GreenfootImage background = getBackground();
        colorTint++;
        background.setColor(new Color(colorTint,colorTint,colorTint));
    }
This is my world, and I have it in act() nothing happens when I run the scenario. wtf.jpg
JetLennit JetLennit

2013/10/22

#
Do you get an error message? (and I think you need to add
setBackground(background);
)
danpost danpost

2013/10/22

#
All you are doing with line 5 is setting the drawing color for the background (you are not changing the background at all with that statement). You need to follow it with a command that actually changes the background. I think these are the ones that use the set color: 'fill', 'fillOval', 'fillRect', 'drawLine', 'drawOval', 'drawRect'.
davmac davmac

2013/10/22

#
It is as danpost says. The documentation for the method clearly states: Set the current drawing color. This color will be used for subsequent drawing operations.
You need to login to post a reply.