0

i made it as a beginner to week for but now i seriously i am lost with breakout.

Where it says todo for the paddle i put in,

GRect initPaddle(GWindow window)
{

    GRect paddle= newGRect(WIDTH/2-paddlew/2 ,HEIGHT-paddleh,paddlew,paddleh);
    setColor(paddle,ORANGE);
    add(window, paddle);
    return paddle;

    return NULL;
}

If i just return paddle, the paddle is not shown at all.

And setColor does not work either, i just get error: use of undeclared identifier 'ORANGE' setColor(paddle,ORANGE);

i really wanna not give up on that course but to me that problems is just such a jump from the previous stuff.

like the recommendation :Finallz instatiate your paddle with newGRect.. i have no idea what that means ? maybe call newGRect somewhere ?

Also i should return "the GRect".. which i thought can only mean return what i called paddle.

Can anybody give me some ideas to it so i can keep going please :(

1
  • I suggest that you drop the second return satement, the one with the NULL. It should not affect anything, but it will never be executed because you return from the function with paddle, so it will never reach the last return statement. Commented Feb 10, 2015 at 22:19

3 Answers 3

1

Drop the 'return NULL' statement. It's redundant.

Also, the problem with setColor is that your ORANGE needs to be a string -> "ORANGE" You also need to make color visible using setFilled before using setColor.

Play around with the co-ordinates a bit, if you can't see the paddle.

0
0

If i just return paddle, the paddle is not shown at all.

I assume this is because there is an error with setColor.

And setColor does not work either, i just get error: use of undeclared identifier 'ORANGE' setColor(paddle,ORANGE);

The second argument for setColor should be a string. ORANGE is not a string literal and there is no defined variable/value with that name so you get an error.

Also i should return "the GRect".. which i thought can only mean return what i called paddle.

It does mean that.

0

I think the missing set location should be the problem, remember, you have to give coordinates for it's height and width, and coordinates to place it on the window, also, research the fill color functions

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .