0

I can't copy the code from VMWare to Windows, so I took a screenshot: https://i.stack.imgur.com/jrqh3.jpg What am I doing wrong? I think my logic is correct and my code should work.

I get this output: https://i.stack.imgur.com/lhCbE.jpg

1
  • I'm having trouble too, but I can see that you are not checking if you have gone beyond 400, the width of the window. You should check for that and have the bricks start on the next line. Jun 3, 2015 at 1:13

1 Answer 1

1

Look at the value of X after you create your first row of bricks. Using your image, that's 9 bricks in the first row. The 10th brick is going to be at x=405, outside the window. How are you going to position the 10th brick as the first brick of the next row? There's something missing. (Trying to make you think instead of just giving the answer. ;-) )

BTW, I noticed that there is no space between the top of the window and the top row of bricks. It's going to be kind of hard for the ball to get up there and bounce between the top of the window and the bricks, don't you think?

If this answers your question, please mark it as answered. Let's do the housekeeping on the forum. ;-)

You must log in to answer this question.

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