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

The Bricks

Now we'll create a 2-dimensional array to hold bricks, use a couple loops to draw the ones that haven't been broken, and make sure to remove bricks when they've been hit.

Try adding code to make the ball bounce in different directions based on where it hits the paddle.

It seems at every step as if what we have is getting closer to being a real game, but that it's never quite there. One thing that's for sure is that this version of the game is ugly; on the next page we'll jazz it up a bit.

next prev