Class Ship
java.lang.Object
|
+--java.util.Observable
|
+--Body
|
+--Ship
- All Implemented Interfaces:
- java.io.Serializable
- Direct Known Subclasses:
- DefaultShip
- public class Ship
- extends Body
A ship is a body associated with a player. Has an intrinsic turning and
acceleration rate.
- See Also:
- Serialized Form
Inner Class Summary |
protected class |
Ship.Fire
The event of this ship firing its weapon. |
Fields inherited from class Body |
angle, creation, id, movementX, movementY, player, positionX, positionY, radius, time, type |
Constructor Summary |
Ship(int player,
long when)
|
Method Summary |
void |
deactivate()
Deactivation is called from disable before master goes null. |
protected void |
fireOnce(long when)
Fire weapon once. |
void |
setAccelerating(boolean start)
Start or stop accelerating. |
void |
setFiring(boolean start)
Start or stop firing weapon. |
protected void |
setFiringOff()
Separated from setFiring so can get away w/ no exn in an exn handler |
void |
setTurning(int direction,
long when)
Start or stop turning. |
Methods inherited from class Body |
activate, collision, collisionCheck, collisionCheck, destroy, disable, enable, getAcceleration, getAngle, getId, getMaster, getPlayer, getRadius, getTime, getType, getX, getY, isAccelerating, project, setAcceleration, setAngleRate, update, updateComponents |
Methods inherited from class java.util.Observable |
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Ship
public Ship(int player,
long when)
setTurning
public void setTurning(int direction,
long when)
throws Body.DisabledException
- Start or stop turning.
- Parameters:
direction
- Ship.TURN_LEFT, Ship.TURN_STOP, or Ship.TURN_RIGHT.
setAccelerating
public void setAccelerating(boolean start)
throws Body.DisabledException
- Start or stop accelerating.
setFiring
public void setFiring(boolean start)
throws Body.DisabledException
- Start or stop firing weapon.
setFiringOff
protected void setFiringOff()
- Separated from setFiring so can get away w/ no exn in an exn handler
fireOnce
protected void fireOnce(long when)
- Fire weapon once.
deactivate
public void deactivate()
- Description copied from class:
Body
- Deactivation is called from disable before master goes null. Cancel
tasks here. Overlay to cancel more tasks.
- Overrides:
deactivate
in class Body