CSE115.FishBowl
Interface MovingBody

All Superinterfaces:
Colorable, EventListener, Graphic, Locatable, MouseListener, MouseMotionListener, Reactor, Rotatable, Shape, Sizeable
All Known Implementing Classes:
Fish, MovingBodyAdapter

public interface MovingBody
extends Shape

Normal users can ignore this interface. Methods needed for body that can be animated and moved. Motion accomplished either through updates of velocity or by use of Vectors.

Version:
2.0 (February 17, 2006)
Author:
Phil Ventura with updates by Adrienne Decker

Field Summary
 
Fields inherited from interface NGP.Colorable
DEFAULT_GRAY
 
Method Summary
 Integer getDx()
          Returns the horizontal velocity.
 Integer getDy()
          Returns the vertical velocity.
 Vector getVector()
          This method is to be used to obtain a Vector from a MovingBody.
 void setVector(Vector newVector)
          This method is to be used to pass a Vector to a MovingBody.
 void setVelocity(Integer dx, Integer dy)
          Sets the horizontal and vertical velocity.
 void update()
          Called frequently to update the body's position on the screen.
 
Methods inherited from interface NGP.Graphic
contains, getBounds, getCenterLocation, getDrawingPanel, hide, intersects, paint, setDrawingPanel, show
 
Methods inherited from interface NGP.Reactor
react
 
Methods inherited from interface java.awt.event.MouseListener
mouseClicked, mouseEntered, mouseExited, mousePressed, mouseReleased
 
Methods inherited from interface java.awt.event.MouseMotionListener
mouseDragged, mouseMoved
 
Methods inherited from interface NGP.Rotatable
getRotation, setRotation
 
Methods inherited from interface NGP.Locatable
getLocation, setLocation
 
Methods inherited from interface NGP.Sizeable
getDimension, setDimension
 
Methods inherited from interface NGP.Colorable
getColor, setColor
 

Method Detail

getDx

Integer getDx()
Returns the horizontal velocity.

Returns:
the horizontal velocity.

getDy

Integer getDy()
Returns the vertical velocity.

Returns:
the vertical velocity.

setVelocity

void setVelocity(Integer dx,
                 Integer dy)
Sets the horizontal and vertical velocity.

Parameters:
dx - the new horizontal velocity.
dy - the new vertical velocity.

setVector

void setVector(Vector newVector)
This method is to be used to pass a Vector to a MovingBody.

Parameters:
newVector - The Vector to pass to the MovingBody.

getVector

Vector getVector()
This method is to be used to obtain a Vector from a MovingBody.

Returns:
A Vector.

update

void update()
Called frequently to update the body's position on the screen.