1
Ich programmiere das Spiel Breakout in Java. Mein Hintergrund ist zunächst grau, aber wenn ich gewinne, möchte ich, dass er grün wird. Dies kann ich jedoch nicht erreichen. Kann mir jemand helfen?Ändern Sie meinen Hintergrund in einer Methode Java
Hier sind die Farben deklariert;
// 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
und dies ist mein Gewinn() Methode:
// This method is called when you win
public void win() {
ball=null;
paddle=null;
// the background is set to green
FieldColor= Color.green;
}
Also dann müsste es so sein: \t \t \t gContext.setColor (new Color (0x99FF00)); Aber das funktioniert immer noch nicht – Maris