org.deken.game.movement
Class ScriptMovement

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

public class ScriptMovement
extends java.lang.Object
implements Movement

Title: ScriptMovement

Description: ScriptMovement is movement that is done based on ScriptMovementActions. Each ScriptMovementAction is used to determine how the parent moves. ScriptMovementActions is an abstract class and must have a concrete implementation.

Copyright: Copyright (c) Mar 11, 2012

Version:
1.0
Author:
Gary Deken

Constructor Summary
ScriptMovement(Actor actor)
           
 
Method Summary
 void addAction(ScriptMovementAction scriptMovementAction)
          Add another action 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.
 Movement copy(Actor actor)
          Copies the movement.
 float getDirection()
          This returns the direction of the movement.
 GameVector getGameVector()
          This returns the current GameVector for this movement.
 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 isDone()
          Returns if this script has completed all its steps.
 void reset()
          Resets the script to start over.
 void setName(java.lang.String name)
           
 void setRunning(boolean running)
           
 void setSpeed(double speed)
           
 void update(long elapseTime)
          This method takes the elapse time, since the last update, and to determine the next movement to set to the GameVector.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ScriptMovement

public ScriptMovement(Actor actor)
Method Detail

addAction

public void addAction(ScriptMovementAction scriptMovementAction)
Add another action sequence

Parameters:
scriptMovementAction -

collideHorizontal

public void collideHorizontal()
Description copied from interface: Movement
Adjust the horizontal (x axis) movement to a collision.

Specified by:
collideHorizontal in interface Movement

collideVertical

public void collideVertical()
Description copied from interface: Movement
Adjust the vertical (y axis) movement to a collision.

Specified by:
collideVertical in interface Movement

collideLayer

public void collideLayer()
Description copied from interface: Movement
Adjust the layer (z axis) movement to a collision.

Specified by:
collideLayer in interface Movement

copy

public Movement copy(Actor actor)
Description copied from interface: Movement
Copies the 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()
Description copied from interface: Movement
This returns the current GameVector for this movement.

Specified by:
getGameVector in interface Movement
Returns:
GameVector

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

isDone

public boolean isDone()
Returns if this script has completed all its steps.

Returns:
boolean

reset

public void reset()
Resets the script to start over. Resetting all current indices and actions back to 0. Resets the running to true.


setName

public void setName(java.lang.String name)

setRunning

public void setRunning(boolean running)

setSpeed

public void setSpeed(double speed)

update

public void update(long elapseTime)
Description copied from interface: Movement
This method takes the elapse time, since the last update, and to determine the next movement to set to the GameVector.

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