fishbowl
Class Fish
java.lang.Object
graphics.AbstractGraphic
graphics.AbstractColorableGraphic
graphics.Polygon
fishbowl.Fish
- All Implemented Interfaces:
- CenterLocatable, IColorable, IColorableGraphic, IGraphic, ILocatable, IRotatable, ISizeable, Observer
public class Fish
- extends Polygon
- implements Observer
A Fish that moves when told to.
Created: Thu Sep 29 15:00:55 2005
- Version:
- 1.3
- Author:
- Carl Alphonce
Constructor Summary |
Fish()
Creates a new Fish instance. |
Methods inherited from class graphics.AbstractGraphic |
addMouseListener, addMouseMotionListener, contains, getBounds, getCenterLocation, getContainer, getDimension, getLocation, getMouseListeners, getMouseMotionListeners, getRotation, intersects, move, rotate, setCenterLocation, setContainer, setMovement, setRotation |
Fish
public Fish()
- Creates a new
Fish
instance.
getSize
public Integer getSize()
- Returns the size of the Fish.
- Returns:
- the size of the Fish.
setSize
public void setSize(Integer size)
- Sets the size of the Fish.
- Parameters:
size
- the new size of the Fish
update
public void update()
- Update the position and orientation of the fish based on the
velocity. If the fish hits a wall, it reverses velocity in the
appropriate direction and points in the appropriate direction
too.
getVector
public Vector getVector()
setVector
public void setVector(Vector v)
getDx
public Integer getDx()
getDy
public Integer getDy()
update
public void update(Observable o,
Object arg)
- Specified by:
update
in interface Observer