Homework 3
Breakout
250 points, due 11:59:59 PM on July 26, 2007
Introduction
Breakout, introduced in 1976, is a popular extension to the game of Pong that has been described as "the ultimate in Pong" (Pong came out four years earlier, in ‘72).  Breakout was conceptualized by Nolan Bushnell and Steve Bristow, but the actual hardware was designed by Steve Jobs, CEO of Apple Computer. But it was Jobs’ friend, Steve Wozniak, who did most of the work on Breakout, not Jobs.  Legend has it that Jobs received a \$5,000 bonus for the work, but told Wozniak that he only got \$750, and gave Wozniak his "50%" --- \$375.  This would later add to the already increasing friction between the two, which eventually lead to Steve Wozniak quitting Apple.  Interestingly enough, though, Steve Wozniak seems to no longer harbor much resentment for Apple -- he was first in line for an iPhone at a store in California.
Requirements
In Breakout, a ball bounces around the screen and destroys blocks as it bounces into them. The ball can bounce off of the top and sides of the screen.  If the ball moves off the bottom of the screen, however, the player loses a life. The player controls a paddle at the bottom of the screen to block the ball from moving off the bottom. If the player misses blocking the ball three times, the game should end with the player as the loser. If all the blocks are cleared from the screen, the game should end with the player as a winner.
You will be given a basic version of the game in which a ball starts in the center of the screen and falls towards your paddle. There will also be one block on the screen that will disappear when hit. The paddle's motion is controlled by the mouse. There are two classes that make up this game: Breakout (the game) and BounceTracker (which moves the ball each step of the game).  You should not need to modify the tracker class!
In the class Breakout, you should add code to:
1. 1. Make a collection of blocks in rows across the top of the screen.
2. 2. Make indicators that show how many lives the player has remaining and how many blocks have been cleared (i.e., a score).
3. 3. Detect when the player loses a life, and subtract it from their total.
4. 4. Reset the ball to the center of the screen when a player loses a life.
5. 5. End the game after a player loses three lives, and display a message that declares the player a loser.
6. 6. Add to the player's score each time a block is hit and disappears.
7. 7. End the game when the last block is cleared, and display a message that declares the player a winner.
8. 8. Add two different sounds which play when two certain events occur (a ball hits a block, or you win the game, etc...)
9. 9. Add one image somewhere (for the ball, blocks, paddle, an obstacle, background, etc...)
Note:  You will have to spend some time choosing fixed values for the size of the paddle, speed of the ball, and size of the blocks in order to ensure the game is fun to play. Include some discussion of why you chose the values you did in your code's comments. Note, you do not need to do anything more to implement bouncing than is already given in the code you download for the project.
Extra Credit
Once you have the basic game working, you can add a variety of features to make your game more fun to play (listed below roughly in order of difficulty):
•    Give the blocks different colors based on some kind of pattern (e.g., each row is the same color). To get full extra credit for this, you must still create the blocks using a loop (rather than setting each block's color in a long sequence of statements). Note, you may want to create a collection of colors so that you can access them within your loop (e.g., one color for each row you create).
•    Instead of a solid wall of blocks, place the blocks in a pattern (e.g., a "V", or a diamond). Again, you must use a patterns that you can create using a loop rather than placing each block in a sequence of statements.
•    In addition to standard blocks, create special blocks that react differently when hit (e.g., require more hits to disappear or create an extra ball). Note, you may want to store these special blocks in separate collections to make it easier to check for. Also, if your special block needs to remember something (e.g., how many times it has been hit), you may need to create separate class for it that extends Sprite.
•    When the collection of blocks is completely cleared, start a new level and create another pattern of blocks, instead of ending the game. To make each level different, you might make each block worth more points, each pattern of blocks different, or the ball move faster each time. In this case, it may no longer be possible to win the game (or there may be a fixed number of levels). To implement levels successfully, you will need to be very careful about defining variables to control different values in your game (e.g., ball's velocity or score for each brick).

Please include, on your applet website, a description of the extra credit features you attempted so that there is less chance we miss them when we are grading your assignment.
Submitting