Prev Up Next
Go backward to Moving the Ball
Go up to Top
Go forward to Adding a Paddle

Bouncing

The code required to make the ball bounce is even simpler than it was in the bouncing ball applet since your ball shouldn't slow down when it bounces. To be cautious about this step, we will add the bouncing code one wall at a time. We will treat all four walls the same for now, and then modify the code to account for the fact that the ball should fall off the bottom if the paddle isn't in its way later. If you are feeling confident, don't hesitate to go ahead and do all the walls at once.

  • The Right Wall
  • The Other Walls

  • Prev Up Next