unc.cdva.interactiveitems
Class MobileItem

java.lang.Object
  extended by unc.cdva.utils.TaggedObject
      extended by unc.cdva.interactiveitems.InteractiveItem
          extended by unc.cdva.interactiveitems.AnimatedItem
              extended by 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.
 
Fields inherited from class unc.cdva.interactiveitems.InteractiveItem
direction, position, scaling
 
Constructor Summary
MobileItem()
           
 
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 unc.cdva.interactiveitems.InteractiveItem
getDirection, getPdsBean, getPosition, getScaling, getState, setDirection, setPds, setPosition, setScaling, setState
 
Methods inherited from class unc.cdva.utils.TaggedObject
createId, equals, getId, hashCode, setId, setId
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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
Constructor Detail

MobileItem

public MobileItem()
Method Detail

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.