CS102 Lab4 

COMP-102 Breakout part 2

Due April 18th at Midnight (You have 3 weeks for this lab)


In this lab you will build on your last lab to build a complete (though simple) one level breakout game. You will add bricks, a paddle and check to see if the game has been won or lost.


The high level objectives of this lab are:

What you must do:

Expand your program from last time to include two more classes, the Paddle class and the Brick class. The UML diagram below adds thess new classes, but leaves you much more flexibility to implement this part of the project. Your intutition about the best way to implement this small project may be different and since there is no following project, you can try out your design. Note however that you must have a List of Blocks as an instance variable in your GamePanel class and use that list to store all of your Blocks for the game


Added Program functionality

In addition to the basic functionality that you added last time, your game needs to be able to do the following exta things

Other requirements

As always

Where should you start?

If you are comfortable with programming labs of this size, you are welcome to do the work in any order that you like. If you are not as comfortable with the idea of starting in on a project of this size with this much freedom to innovate (or to shoot yourself in the foot) then I have the following suggestions for where to begin and what order to build these components.
  1. Write a block class. (it should know at least its own position - and probably its color - you might need constants for height and width as well)
  2. Create the List of blocks. (instance variable, and fill the instance variable)
  3. Display the blocks on the screen (add to your paintComponent or put it in another method which is called by paintComponent - be sure to pass the Graphics object if using this latter technique)
  4. Create the paddle class (again it needs to know its position and size)
  5. Display the paddle.
  6. Get the paddle moving
  7. start working on collision detection (consider changing the getNewPos method in your Ball class so that it takes both the paddle and the List. check for collisions before returning a new position
  8. check to see if the game has been lost and act appropriately if so
  9. remove bricks that have been hit
  10. reset the game board when new game is pressed

really 7-9 could be done in any order so long as 1-6 are done first.

Extra Credit Available

For extra credit, play a sound whenever the ball destroys a brick, and another if the player loses. Extra credit is only available for those who have finished all of the required sections of the lab and will be applied to the lab portion of your grade.  Extra credit will be applied to the lab portion of your grade and will be worth 7 points on this project. 

For those who didn't quite get the last project working

Because this project relies on the last one, I will make my solution to the last project is available. I don't want to influence anyone who is trying to take the 50% penalty and turn in the first project a day late.


When your program is ready, you need to write a readme.txt file that provides me the following information:

When your readme and your code is ready, zip up your files and email them to me as you did in the last three labs.