My breakout program is getting near completion. I found the following problem, though. After hitting the bottom, I'm erasing the old ball, placing a new ball in the same manner as in the starting routine, then wait for the click as shown below.

enter image description here

The new ball does appear at the center of the window, but it stays there even I click (or right click) the mouse. The paddle does not move, either. So it looks like the whole program gets frozen. My GDB analysis shows the program resumes the subsequent steps and eventually reaches ball moving steps. Then why the ball does not move?! If anyone can give me suggestions, I would very much appreciate it... Thank you in advance!

  • Have you set the value of lives to be 3 beforehand and included the above code in a loop?
    – sinister
    Dec 11, 2014 at 3:56
  • Yes, I checked it on my GDB analysis. Initial value was 3, and after hitting the bottom, it has been reduced to 2.
    – Yoshi Watt
    Dec 11, 2014 at 7:14
  • And does that loop decrementing it once everytime?
    – sinister
    Dec 11, 2014 at 7:53
  • Hi Sinister (you have strange name, my name Yoshi, by the way, means 'good' in Japanese). Yes, it looks that way, since the game ends after ball hitting the bottom 3 times. Now I'm struggling with final stage, the scoreboard ititialize and updating. I have compiler error in update portion, which is supposed to be complete.
    – Yoshi Watt
    Dec 12, 2014 at 14:35
  • What sort of compilation error? BTW that's just a username, I have a good real name on my profile.
    – sinister
    Dec 13, 2014 at 2:38

2 Answers 2


Instead of removing the ball and paddle from the window with removeGWindow, why not use another command (hint, hint) to change their positions back to where they began? Then you can allow normal play to resume with WaitForClick(), which is definitely a good plan to use. Also, you may want to think about simply using lives--; instead the self-refence you have in your example for lowering the lives, its just a bit overly complicated.

  • Thank you Josh, I will think about it...
    – Yoshi Watt
    Dec 11, 2014 at 7:15
  • 1
    Josh, thanks. With your hint, I could get the ball moving as well as the paddle. Now I can proceed to the final stage; setting up the scoreboard. Thanks again!!
    – Yoshi Watt
    Dec 11, 2014 at 10:17
  • Im happy I could help, Yoshi! I got stuck on the same portion for a while as well, so Im glad I could help out (although, frankly, you deserve more credit than I do - you still figured out the correct way to do things all on your own!) Dec 11, 2014 at 17:29
  • someone please explain (hint,hint) command. i'm not able to understand how to use this command Dec 14, 2014 at 13:58
  • I too did not get the (hint, hint) at first but the answer to that lies in the 'position' of the object(ball). Jan 24, 2015 at 9:41

Go to this link from #2 of the pset under the Title "Breakout" http://d2o9nyf4hwsci4.cloudfront.net/2013/fall/psets/4/pset4/pset4/spl/doc/gobjects.html

There is a function there that does what he is talking about.

You must log in to answer this question.

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