org.deken.game.movement
Class ToTile4Movement

java.lang.Object
  extended by org.deken.game.movement.BaseMovement
      extended by org.deken.game.movement.ToTile4Movement
All Implemented Interfaces:
Movement, Updateable
Direct Known Subclasses:
FourKeyToTile4Movement, PathFindingToTile4Movement, WanderToTile4Movement

public abstract class ToTile4Movement
extends BaseMovement
implements Movement

Title: ToTileMovement

Description: TODO

Copyright: Copyright (c) Sep 16, 2012

Version:
1.0
Author:
Gary Deken

Field Summary
protected  int currentXTile
           
protected  int currentYTile
           
protected  MapSize mapSize
           
protected  boolean movingToTile
           
protected  Actor parent
           
protected  boolean running
           
protected  double speed
           
protected  double targetX
           
protected  int targetXTile
           
protected  double targetY
           
protected  int targetYTile
           
 
Fields inherited from class org.deken.game.movement.BaseMovement
gameVector, name
 
Constructor Summary
ToTile4Movement()
           
ToTile4Movement(MapSize mapSize, Actor parent)
           
 
Method Summary
protected  void checkReverseDirection()
          This method must be over-ridden if the implementing class can reverse, direction when moving between tiles.
 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.
 ToTile4Movement copyBase(ToTile4Movement toTileMovement)
           
protected abstract  GameVector.DIRECTION getDirectionEnum()
           
 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.
protected  boolean isMovingToTile()
           
protected abstract  void markTileReached()
           
 void reset()
           
 void setRunning(boolean running)
           
 void setSpeed(double speed)
           
protected  void setTargetTile()
           
 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 org.deken.game.movement.BaseMovement
baseCopy, getDirection, getGameVector, getName, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.deken.game.movement.Movement
copy, getDirection, getGameVector
 
Methods inherited from interface org.deken.game.Updateable
getName
 

Field Detail

mapSize

protected MapSize mapSize

currentXTile

protected int currentXTile

currentYTile

protected int currentYTile

targetXTile

protected int targetXTile

targetYTile

protected int targetYTile

targetX

protected double targetX

targetY

protected double targetY

speed

protected double speed

parent

protected Actor parent

running

protected boolean running

movingToTile

protected boolean movingToTile
Constructor Detail

ToTile4Movement

public ToTile4Movement()

ToTile4Movement

public ToTile4Movement(MapSize mapSize,
                       Actor parent)
Method Detail

collideHorizontal

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

Specified by:
collideHorizontal 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

collideVertical

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

Specified by:
collideVertical in interface Movement

copyBase

public ToTile4Movement copyBase(ToTile4Movement toTileMovement)

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

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

reset

public void reset()

setRunning

public void setRunning(boolean running)

setSpeed

public void setSpeed(double speed)

checkReverseDirection

protected void checkReverseDirection()
This method must be over-ridden if the implementing class can reverse, direction when moving between tiles. If reversing direction, you must call setTargetTile().


markTileReached

protected abstract void markTileReached()

isMovingToTile

protected boolean isMovingToTile()

getDirectionEnum

protected abstract GameVector.DIRECTION getDirectionEnum()

setTargetTile

protected void setTargetTile()