Breakout Problem Set Javadocs

breakout
Class HitpointsBrick

java.lang.Object
  extended bybreakout.BasicBrick
      extended bybreakout.HitpointsBrick
All Implemented Interfaces:
BreakoutComponent, Brick

public class HitpointsBrick
extends BasicBrick

Example of Brick subclassing. This subclass of BasicBrick keeps track of a certain number of "hit points," and takes that many hits before it dies.


Field Summary
 
Fields inherited from class breakout.BasicBrick
location, size
 
Constructor Summary
HitpointsBrick(int width, int height)
          Creates a new HitpointsBrick with the specified dimensions.
 
Method Summary
 boolean hit(BreakoutComponent bc)
          Determines whether this HitpointsBrick has been hit enough times yet to die.
 void paint(java.awt.Graphics g)
          Paints this HitpointsBrick.
 
Methods inherited from class breakout.BasicBrick
getLocation, getShape, getSize, setLocation, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HitpointsBrick

public HitpointsBrick(int width,
                      int height)
Creates a new HitpointsBrick with the specified dimensions.

Parameters:
width - The intended width of the HitpointsBrick.
height - The intended height of the HitpointsBrick.
Method Detail

hit

public boolean hit(BreakoutComponent bc)
Determines whether this HitpointsBrick has been hit enough times yet to die.

Specified by:
hit in interface BreakoutComponent
Overrides:
hit in class BasicBrick
Parameters:
bc - Rebounding/BreakoutComponent that hit this HitpointsBrick.
Returns:
true if we died; false otherwise.

paint

public void paint(java.awt.Graphics g)
Paints this HitpointsBrick.

Specified by:
paint in interface BreakoutComponent
Overrides:
paint in class BasicBrick
Parameters:
g - Graphics object for this ball's coordinate frame(ie, already located where we are).

Breakout Problem Set Javadocs