org.deken.game.movement
Class ToCorner4Movement

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

public abstract class ToCorner4Movement
extends BaseMovement
implements Movement

Title: ToCorner4Movement

Description: TODO

Copyright: Copyright (c) Dec 8, 2012

Version:
1.0
Author:
Gary Deken

Field Summary
protected  int currentXTile
           
protected  int currentYTile
           
protected  MapSize mapSize
           
protected  Actor parent
           
protected  boolean running
           
protected  double speed
           
protected  int targetXTile
           
protected  int targetYTile
           
 
Fields inherited from class org.deken.game.movement.BaseMovement
gameVector, name
 
Constructor Summary
ToCorner4Movement()
           
ToCorner4Movement(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.
 ToCorner4Movement copyBase(ToCorner4Movement toCorner4Movement)
           
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 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

speed

protected double speed

parent

protected Actor parent

running

protected boolean running
Constructor Detail

ToCorner4Movement

public ToCorner4Movement()

ToCorner4Movement

public ToCorner4Movement(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 ToCorner4Movement copyBase(ToCorner4Movement toCorner4Movement)

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

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()

setRunning

public void setRunning(boolean running)

setTargetTile

protected void setTargetTile()