1. Introduction
  2. Draw a Circle
  3. Add Some Color
  4. Action
  5. Library: an Interlude
  6. Bounce
  7. Add a Paddle
  8. The Keyboard
  9. The Mouse
  10. The Bricks
  11. Finishing Touches
  12. Coda

Bounce

Our ball can fly, but it runs away too quickly; let's contain it in our box by rebounding off the walls.

Try to change the draw() function so that the ball accelerates or decelerates every time it hits a wall.

next prev