hab ein for loop in dem ich
aufrufe nun hab ich aber das problem das immer nur ein rechteck erstellt wird und das dann bewegt wenn ich den x oder y wert ändere der ganze for loop siet so aus
map ist ein doppel array aus objecten die so ausehen
sind also nur dafür da um ein paar sachen zu speichern
jetzt ist meine theorie das was ich im titel gesagt hab das aber wenn das so ist wie könnte ich das dann machen
Java:
g.fillreckt(); g.setColor();
Java:
for(int i = 0; i < map.length; i++){
for(int j = 0; j < map[i].length; j++){
g.setColor(map[i][j].color);
g.fillRect(map[i][j].x, map[i][j].y, map[i][j].width, map[i][j].height);
map[i][j].x += 25;
map[i][j].y += 25;
}
}
map ist ein doppel array aus objecten die so ausehen
Java:
package graphics;
import java.awt.Color;
public class Cube {
public int width;
public int height;
public int x;
public int y;
public Color color;
public Cube(int width, int height, Color color, int x, int y){
this.width = width;
this.height = height;
this.x = x;
this.y = y;
this.color = color;
}
}
jetzt ist meine theorie das was ich im titel gesagt hab das aber wenn das so ist wie könnte ich das dann machen