0

Till the time my ball is at rest i can see my paddle but as as i start moving my ball my paddle disappears. My code for paddle is:code for paddle

and my code for ball is:code for ball

please help me as i have spent hours to solve this problem but still then i'm not able to resolve this problem.

1 Answer 1

-1

I'll try to give you a hint without giving out much of the solution. The "aha..!" moment is extra special when you finally get to solve one of these problems. The more you struggled, the bigger the smile afterwards ;)

First thing to notice here:

  • The structure of your program lies (and generally should lie) in main(). It's from main that you call other functions in time, in order for the game to happen.

  • In the code provided by the staff (in the "distro") there already is a while() loop. It's there to ensure your program runs as long as the loop's conditions are met.

  • Check out exactly where in the distro's code does the call to initBall() lie. Is it supposed to happen indefinitely? Or just once?

One more hint: you don't need to only use functions prototyped in the distro. You can come up with as many "helper functions" of your own as you need.

HTH!

P.S. 1: don't hesitate to comment again here if you get stuck :)

P.S. 2: If you make any progress, or changes to your code, please feel free to edit your question adding the new info.

2
  • Thanx for the help. It was very helpfull. Commented Dec 10, 2014 at 18:59
  • I wish I knew why this accepted answer got downvoted =/
    – abelinux
    Commented Dec 11, 2014 at 21:53

You must log in to answer this question.

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