CSE 131 Module 10: Class Hierarchies
You are encouraged in this module to:
- Take the work you have done with others in studio as a starting point.
- Work with others on this module, perhaps those from your studio group.
Note: Your submission of this module must include
a detailed account of your specific contributions. You are not permitted
to coast along with others doing the work. Thus, you must find a group
in which you can contribute equally. It is necessary that you personally
master the concepts of object hierarchies, inheritance, and polymorphism
to gain credit for this module.
Brickbreaker is the game that you, CSE131 students, have
identified as worthy of your efforts for our final assignment.
The design and implementation of Brickbreaker also nicely demonstrates
the principles of this module and incorporates components (Vector,
etc.) that we have developed this semester.
In studio and lecture, you have helped develop a design
of Brickbreaker, and an initial implementation was given to you
in the studio.
As you consider the assignment below,
you will need to make small changes to the existing code base in
However, most of your code should be in classes that extend the functionality
of existing classes. In each extending class, try to write as little code
as possible, using inheritance to avoid duplicating existing code.
Familiarize yourself with the provided code base by
- Reading the
- Reading the code you have worked on from studio.
If you did not get through all the studio material,
take some time to work through the parts you need for the game. Ask
for help if you need it. It will be easier to do the work if you
have a secure understanding of the principles of this module and the
design of the game, before you start writing code.
Here's what you should do to get credit for Module 10 lab:
- Some interesting action should be taken when a Ball hits (intersects with) a
Currently, the Controller arranges for things to happen when
a Ball hits any of the four perimeter surfaces. Also,
a Brick is killed when it hits the floor,
but that is just for demonstration purposes.
You must develop three different kinds
of bricks. The brick types must be distinguishable by color, so that we can
tell in a demo how each brick should behave.
Think about the various behaviors you want for your three kinds of bricks.
What do those behaviors have in common? Try to develop a superclass that
captures common functionality, and extend that class to get the variation
of behavior you desire.
Here are some ideas about various Brick-like behaviors, but feel free
to invent and experiment with your own:
- A brick might require being hit a few times before it is willing to
- A brick might fall when dead, possibly hitting other bricks and contributing
to their demise.
- A brick when hit might introduce another Ball (or two, or three...) into
- A brick might affect the speed of the Ball when hit.
- Your game must include at least two kinds of Balls, whose
types must be visually distinguished by their color.
Here are some ideas about Ball-like behaviors, but again feel free
to improvise, invent, and experiment:
- The various balls could be distinguished by their size, speed, or
ability to kill bricks.
- A ball of a given color might be more successful at hitting bricks
of similar color.
- A ball might randomly change trajectory based on some observable event.
Note for the directions below. Use
this file for a cover page file. Just
copy it into your eclipse workspace and be sure to commit it.
Submitting your work (read carefully)
- Complete the cover-page.txt file
in the repository for this lab. Just open it up in your eclipse editor
and type in your responses.
- In the cover-page.txt file, be sure to indicate anybody with whom
you have collaborated on the work you are submitting.
- You must commit all of your work to your repository. It's best to do this
from the top-most level of your repository, which bears your name and student ID.
- You must demo the commited work to a TA. Make sure the TA knows that
your demo is for credit at this point.
- The TA must have your name and information
on a lab demo sheet for this lab to be graded and
Be sure your name and ID are written
clearly on the TA's demo sheet.
Last modified 19:55:26 CST 18 November 2009
by Ron K. Cytron