JAVA
I'm trying to make there be ten rows of GRect bricks with a for loop, but after the first run they just stack on each other. If someone could tell me why that is, I'd appreciate it

for (int i = 0; i < 10; i++) {
GRect oneBrick = new GRect(0, BRICK_Y, BRICK_WIDTH, BRICK_HEIGHT);
add(oneBrick);
GRect twoBrick = new GRect(BRICK_WIDTH + BRICK_SEP, BRICK_Y, BRICK_WIDTH, BRICK_HEIGHT);
add(twoBrick);
GRect threeBrick = new GRect(BRICK_WIDTH*2 + BRICK_SEP*2, BRICK_Y, BRICK_WIDTH, BRICK_HEIGHT);
add(threeBrick);
GRect fourBrick = new GRect(BRICK_WIDTH*3 + BRICK_SEP*3, BRICK_Y, BRICK_WIDTH, BRICK_HEIGHT);
add(fourBrick);
GRect fiveBrick = new GRect(BRICK_WIDTH*4 + BRICK_SEP*4, BRICK_Y, BRICK_WIDTH, BRICK_HEIGHT);
add(fiveBrick);
BRICK_Y = BRICK_Y_OFFSET+10;
}

Q&A Education