1
Java'da oyun Breakout'u programlıyorum. Önce arka plan gri, ama kazandığım zaman yeşile dönmesini istiyorum. Ancak, bunu başarmayı başaramıyorum. Birisi bana yardım edebilir mi?Arka planımı bir yöntemde değiştir Java
Renkler burada açıklanmıştır;
// 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
ve bu benim kazan() yöntemidir:
// This method is called when you win
public void win() {
ball=null;
paddle=null;
// the background is set to green
FieldColor= Color.green;
}
Öyleyse böyle olması gerekir: \t \t \t gContext.setColor (yeni Renk (0x99FF00)); Ancak bu hala çalışmıyor – Maris