unc.cdva.interactiveitems
Class MobileItem
java.lang.Object
unc.cdva.utils.TaggedObject
unc.cdva.interactiveitems.InteractiveItem
unc.cdva.interactiveitems.AnimatedItem
unc.cdva.interactiveitems.MobileItem
- All Implemented Interfaces:
- Taggable
- Direct Known Subclasses:
- Projectile, RangeCar, Target
public abstract class MobileItem
- extends AnimatedItem
Abstract class for mobile items. Adds a couple of states
that all mobile items must have.
- Author:
- Dan Van Atta
Field Summary |
protected int |
MOVING
Used a state identifier, for when a object is moving. |
protected int |
STOPPED
Used a state identifier, for when a object is stationary. |
Method Summary |
abstract void |
advanceInTime(long delta)
Method to indicate the passage of time. |
boolean |
isMoving()
|
boolean |
isStopped()
|
void |
setMoving()
Puts the object in the 'moving' state. |
void |
setStopped()
Puts the object in the 'stopped' state. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
MOVING
protected final int MOVING
- Used a state identifier, for when a object is moving.
- See Also:
- Constant Field Values
STOPPED
protected final int STOPPED
- Used a state identifier, for when a object is stationary.
- See Also:
- Constant Field Values
MobileItem
public MobileItem()
advanceInTime
public abstract void advanceInTime(long delta)
- Method to indicate the passage of time. This method is
what achieves object motion in essence. This method is
often called by a timer to indicate the passage of time,
and thus the object should update it's position value etc..
- Specified by:
advanceInTime
in class AnimatedItem
- Parameters:
delta
- The amount of time to elapse (in ms)
setMoving
public void setMoving()
- Puts the object in the 'moving' state.
setStopped
public void setStopped()
- Puts the object in the 'stopped' state.
isMoving
public boolean isMoving()
- Returns:
- True if the object is in the moving state, false otherwise.
isStopped
public boolean isStopped()
- Returns:
- True if the object is in the stopped state, false otherwise.