This is my code so far for creating bricks, and it works:
bricks = new Brick[5];
this.createBricks();
private void createBricks(){
for (int i = 0; i < 5; i++) {
Brick brick = new Brick(0,0, Color.RED);
bricks[i] = brick;
}
}
With this code I´m able to get one brick, but I´m quite sure that all my bricks now is on the same position. So I need help with how I write the positions(in my current code: 0,0) so that the bricks is displayed next to each other, in rows and columns.
Update:
Brick[][] bricks = new Brick[5][5];
this.createBricks();
private void createBricks(){
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 5; j++) {
Brick brick = new Brick(i,j, Color.RED);
bricks[i][j] = brick;
}
}
}