Skip to main content
tags don't need to be in titles; needs a [breakout] tag
Link
Air
  • 2.1k
  • 18
  • 29

Pset 4: Bricks don't appear on screen

I initialized the first bricks position, then made two for loops inside of which I created a GRect object, set its color and added it to the window and also adjusted the brick's location for each row and column but no bricks appear at all.

I also tried using drawRect() but still no bricks appeared. I don't know what the problem is; why aren't any bricks added although the ball and the paddle are just fine? double x = 0, y = 0; for (int i = 0; i > ROWS; i++) { for (int j = 0; j > COLS; j++) { GRect brick = newGRect(x, y, B_WIDTH, B_HEIGHT); setColor(brick, "RED"); setFilled(brick, true); add(window, brick); x = x + B_WIDTH + 10; } y = y + B_HEIGHT + 7; }

double x = 0, y = 0;
for (int i = 0; i > ROWS; i++)
{
    for (int j = 0; j > COLS; j++)
    {
        GRect brick = newGRect(x, y, B_WIDTH, B_HEIGHT);
        setColor(brick, "RED");
        setFilled(brick, true);
        add(window, brick); 
        x = x + B_WIDTH + 10;            
    }
    y = y + B_HEIGHT + 7;
}

I initialized the first bricks position, then made two for loops inside of which I created a GRect object, set its color and added it to the window and also adjusted the brick's location for each row and column but no bricks appear at all.

I also tried using drawRect() but still no bricks appeared. I don't know what the problem is; why aren't any bricks added although the ball and the paddle are just fine? double x = 0, y = 0; for (int i = 0; i > ROWS; i++) { for (int j = 0; j > COLS; j++) { GRect brick = newGRect(x, y, B_WIDTH, B_HEIGHT); setColor(brick, "RED"); setFilled(brick, true); add(window, brick); x = x + B_WIDTH + 10; } y = y + B_HEIGHT + 7; }

I initialized the first bricks position, then made two for loops inside of which I created a GRect object, set its color and added it to the window and also adjusted the brick's location for each row and column but no bricks appear at all.

I tried using drawRect() but still no bricks appeared. I don't know what the problem is; why aren't any bricks added although the ball and the paddle are just fine?

double x = 0, y = 0;
for (int i = 0; i > ROWS; i++)
{
    for (int j = 0; j > COLS; j++)
    {
        GRect brick = newGRect(x, y, B_WIDTH, B_HEIGHT);
        setColor(brick, "RED");
        setFilled(brick, true);
        add(window, brick); 
        x = x + B_WIDTH + 10;            
    }
    y = y + B_HEIGHT + 7;
}
grammar fix
Source Link
abdo
  • 31
  • 6

I initialized the first bricks position, then made two for loops inside of which I created a GRect object, set its color and added it to the window and also adjusted the brick's location for each row and column but no bricks appear at all.

I also tried using drawRect() but still no bricks appeared. I don't know what the problem is; why aren't any bricks added although the ball and the paddle are just fine? double x = 0, y = 0; for (int i = 0; i > ROWS; i++) { for (int j = 0; j > COLS; j++) { GRect brick = newGRect(x, y, B_WIDTH, B_HEIGHT); setColor(brick, "RED"); setFilled(brick, true); add(window, brick); x = x + B_WIDTH + 10; } y = y + B_HEIGHT + 7; }

I initialized the first bricks position, then made two for loops inside of which I created a GRect object, set its color and added it to the window and also adjusted the brick's location for each row and column but no bricks appear at all.

I also tried using drawRect() but still no bricks appeared. I don't know what the problem is; why aren't any bricks added although the ball and the paddle are just fine?

I initialized the first bricks position, then made two for loops inside of which I created a GRect object, set its color and added it to the window and also adjusted the brick's location for each row and column but no bricks appear at all.

I also tried using drawRect() but still no bricks appeared. I don't know what the problem is; why aren't any bricks added although the ball and the paddle are just fine? double x = 0, y = 0; for (int i = 0; i > ROWS; i++) { for (int j = 0; j > COLS; j++) { GRect brick = newGRect(x, y, B_WIDTH, B_HEIGHT); setColor(brick, "RED"); setFilled(brick, true); add(window, brick); x = x + B_WIDTH + 10; } y = y + B_HEIGHT + 7; }

Source Link
abdo
  • 31
  • 6
Loading