I am programming the game Breakout in Java. My background is grey at first, but when I win I want it to change to green. However, I cannot manage to achieve this. Can somebody help me?
Here the colors are declared;
// Those are the basic statements and properties of the game and prepares the game to start
int numberlost =0;
Graphics gContext;
Image buffer;
Thread thread;
boolean leftArrow = false;
boolean rightArrow = false;
boolean ballready = true;
boolean extraball=false;
Ball ball;
Field brick;
Paddle paddle;
public static final Color
PaddleColor=Color.black,
ObstacleColor=Color.red,
BallColor=Color.red;
public static Color FieldColor = new Color(0xcccccc); // background is hexidemal color grey
and this is my win() method:
// This method is called when you win
public void win() {
ball=null;
paddle=null;
// the background is set to green
FieldColor= Color.green;
}