Hi,
ich will gerade ein Tic Tac Toe Speil programmieren. Ich scheitere momentan beim Kreuz zeichnen:
Es wird nur das Spielfeld gezeichnet.
Was mache ich falsch?!
Liebe Grüße
Reality
ich will gerade ein Tic Tac Toe Speil programmieren. Ich scheitere momentan beim Kreuz zeichnen:
Code:
public void paint(Graphics g){
//Spielfeld
g.fillRect(60, 120, 150, 2);
g.fillRect(60, 170, 150, 2);
g.fillRect(110, 70, 2, 150);
g.fillRect(160, 70, 2, 150);
// die Zahlen 5 und 5 sind nur zum Testen...
drawCross(g, 5, 5);
}
public void drawCross(Graphics g, int x, int y){
//Ein Kreuz bzw. 'X' malen
int x_pos[] = {x, x+15, x+15, x};
int y_pos[] = {y, y+15, 5, y+15};
g.setColor(Color.RED);
g.drawPolygon(x_pos, y_pos, 2);
}
Es wird nur das Spielfeld gezeichnet.
Was mache ich falsch?!
Liebe Grüße
Reality