Home -> Java -> Breakout (new version)
This is a simple game illustrating Object-Oriented programming, creating simple graphics and using sounds, and working withg threads. The game consists of the following classes:
- Game.java: The main class
- Controller.java: class to handle key events
- Status.java: class to update the status line
- Arena.java: class to contain the drawing area. This is where most of the action takes place. Includes the thread to run in the background.
- Brick.java: Class to represent a single "Brick" and how it is drawn.
- ping.wav: A 'ping' for hitting a wall
- pong.wav: A 'pong' for hitting the paddle or a brickk
- music.wav: background music
Put all classes into one folder, compile, and run the 'Game'
When everything works, answer the following questions:
- Explain which keys are used to control the program
- Explain how the bricks are drawn
- Change the color of the 'simple' bricks
- Change the colors of the 'special' bricks
- Change the arrangements of the bricks
- Explain what determines the speed of the ball
- Change the program so that hitting '>' will speed up the ball more than it currently does.
- Add a 'pass-through' brick that disappears when hit but does not reflect the ball, i.e. the ball passes through the brick
- Add code to show a dialog when the game is finished, i.e. all bricks are gone.
- Add different 'levels' so that when one level is complete, another level appears (perhaps with faster ball and/or smaller panel).