im looking to learn how to change an objects color. and how to access those different colors from another actor. im looking to switch between 2 colors and thats it heres the code i got so far
public class button extends Actor
{
Color color1 = new Color(0, 255, 0);
Color color2 = new Color(255, 0, 0);//red
Color Color = getImage().getColor();
public button(){
setImage(new GreenfootImage(70,50));
getImage().setColor(Color.RED);
getImage().fillOval(0, 0, 20 , 20);
}
public void act()
{
if( getImage().getColor(color2) = Color.RED && Greenfoot.mouseClicked(this)){
getImage().setColor(color1);
}
if(getImage().Color == color1 && Greenfoot.mouseClicked(this)){
getImage().setColor(color1);
}
}
