org.deken.game.movement
Class TimeMovement

java.lang.Object
  extended by org.deken.game.movement.TimeMovement
All Implemented Interfaces:
Movement, Updateable

public class TimeMovement
extends java.lang.Object
implements Movement

Title: TimeMovement

Description: This class allows for setting a Gamepiece's movements based on a sequence of time.

Copyright: Copyright (c) 2006

Version:
1.0
Author:
Gary Deken

Constructor Summary
TimeMovement()
          TimeMovement
 
Method Summary
 void addInputAction(InputAction inputAction, int action)
          Since this class has no InputActions, this method does nothing.
 void addTimeMovementAction(TimeMovementAction timeMovementAction)
          This adds a TimeMovementAction to this TimeMovement, and increases the fullTime of the sequence.
 void collideHorizontal()
          Adjust the horizontal (x axis) movement to a collision.
 void collideLayer()
          Adjust the layer (z axis) movement to a collision.
 void collideVertical()
          Adjust the vertical (y axis) movement to a collision.
 TimeMovement copy(Actor actor)
          Copies this movement
 float getDirection()
          This returns the direction of the movement.
 GameVector getGameVector()
          This returns the current GameVector, based on the time.
 InputAction[] getInputActions()
          This method returns null, since there are no InputAction associated with this.
 java.lang.String getName()
           
 double getXUpdate()
          This returns the amount of X movement for a given update.
 double getYUpdate()
          This returns the amount of Y movement for a given update.
 boolean isRepeats()
          This returns true if this TimeMovement is set to repeat when it completes the sequence.
 void setName(java.lang.String name)
           
 void setRepeats(boolean repeats)
          This flag is used to set whether this time sequence should repeat when it completes.
 void setRunning(boolean running)
           
 void update(long elapseTime)
          This updates the GameVector to the next movement in the sequence, updating the amount to be moved as well.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeMovement

public TimeMovement()
TimeMovement

Method Detail

addInputAction

public void addInputAction(InputAction inputAction,
                           int action)
Since this class has no InputActions, this method does nothing.

Parameters:
inputAction - InputAction
action - int

addTimeMovementAction

public void addTimeMovementAction(TimeMovementAction timeMovementAction)
This adds a TimeMovementAction to this TimeMovement, and increases the fullTime of the sequence.

Parameters:
timeMovementAction - timeMovementAction

collideHorizontal

public void collideHorizontal()
Adjust the horizontal (x axis) movement to a collision.

Specified by:
collideHorizontal in interface Movement

collideVertical

public void collideVertical()
Adjust the vertical (y axis) movement to a collision.

Specified by:
collideVertical in interface Movement

collideLayer

public void collideLayer()
Adjust the layer (z axis) movement to a collision.

Specified by:
collideLayer in interface Movement

copy

public TimeMovement copy(Actor actor)
Copies this movement

Specified by:
copy in interface Movement
Returns:
Movement

getDirection

public float getDirection()
Description copied from interface: Movement
This returns the direction of the movement.

Specified by:
getDirection in interface Movement
Returns:
float

getGameVector

public GameVector getGameVector()
This returns the current GameVector, based on the time.

Specified by:
getGameVector in interface Movement
Returns:
GameVector

getInputActions

public InputAction[] getInputActions()
This method returns null, since there are no InputAction associated with this.

Returns:
InputAction[]

getName

public java.lang.String getName()
Specified by:
getName in interface Updateable
Returns:

getXUpdate

public double getXUpdate()
Description copied from interface: Movement
This returns the amount of X movement for a given update.

Specified by:
getXUpdate in interface Movement
Returns:
double

getYUpdate

public double getYUpdate()
Description copied from interface: Movement
This returns the amount of Y movement for a given update.

Specified by:
getYUpdate in interface Movement
Returns:
double

isRepeats

public boolean isRepeats()
This returns true if this TimeMovement is set to repeat when it completes the sequence.

Returns:
boolean

setName

public void setName(java.lang.String name)

setRepeats

public void setRepeats(boolean repeats)
This flag is used to set whether this time sequence should repeat when it completes.

Parameters:
repeats - boolean

setRunning

public void setRunning(boolean running)

update

public void update(long elapseTime)
This updates the GameVector to the next movement in the sequence, updating the amount to be moved as well.

Specified by:
update in interface Movement
Specified by:
update in interface Updateable
Parameters:
elapseTime - long