org.deken.game.movement
Class WanderToTile4Movement

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

public class WanderToTile4Movement
extends ToTile4Movement
implements Movement

Title: WanderToTile4Movement

Description: This movement moves the Actor in one of four possible directions, based on the map in FindPathFourWay. This extends the ToTile4Movement, moving the actor square by square. By setting up Taboos the Actor will not wander onto those paths.

Copyright: Copyright (c) Sep 8, 2013

Version:
1.0
Author:
aazimon

Nested Class Summary
static class WanderToTile4Movement.FINDING_DIRECTION
          FORWARD_FORWARD = path is always forward FORWARD_BACK = path is forward, but on New Target change go back ANY_BACK = path is first find path, but on New Target change go back ANY_FORWARD = path is first find path, but on New Target change go forward
 
Field Summary
 
Fields inherited from class org.deken.game.movement.ToTile4Movement
currentXTile, currentYTile, mapSize, movingToTile, parent, running, speed, targetX, targetXTile, targetY, targetYTile
 
Fields inherited from class org.deken.game.movement.BaseMovement
gameVector, name
 
Constructor Summary
WanderToTile4Movement()
           
WanderToTile4Movement(MapSize mapSize, Actor parent, FindPathsFourWay findPaths)
           
WanderToTile4Movement(MapSize mapSize, Actor parent, FindPathsFourWay findPaths, WanderToTile4Movement.FINDING_DIRECTION pathFinding)
           
 
Method Summary
 void addTaboo(int xTile, int yTile)
           
 void addTaboo(java.lang.String locationKey)
           
 void collideHorizontal()
          Adjust the horizontal (x axis) movement to a collision.
 void collideVertical()
          Adjust the vertical (y axis) movement to a collision.
 Movement copy(Actor actor)
          Copies the movement.
protected  GameVector.DIRECTION getDirectionEnum()
           
 java.lang.String getName()
           
protected  void markTileReached()
           
 void resetLocation(int xTile, int yTile)
           
 void resetLocation(int xTile, int yTile, int lastXTile, int lastYTile)
           
 void setFindPaths(FindPathsFourWay findPaths, Sprite target)
           
 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.ToTile4Movement
checkReverseDirection, collideLayer, copyBase, getXUpdate, getYUpdate, isMovingToTile, reset, setRunning, setSpeed, setTargetTile
 
Methods inherited from class org.deken.game.movement.BaseMovement
baseCopy, getDirection, getGameVector, 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
collideLayer, getDirection, getGameVector, getXUpdate, getYUpdate
 

Constructor Detail

WanderToTile4Movement

public WanderToTile4Movement()

WanderToTile4Movement

public WanderToTile4Movement(MapSize mapSize,
                             Actor parent,
                             FindPathsFourWay findPaths)

WanderToTile4Movement

public WanderToTile4Movement(MapSize mapSize,
                             Actor parent,
                             FindPathsFourWay findPaths,
                             WanderToTile4Movement.FINDING_DIRECTION pathFinding)
Method Detail

addTaboo

public void addTaboo(int xTile,
                     int yTile)

addTaboo

public void addTaboo(java.lang.String locationKey)

collideHorizontal

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

Specified by:
collideHorizontal in interface Movement
Overrides:
collideHorizontal in class ToTile4Movement

collideVertical

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

Specified by:
collideVertical in interface Movement
Overrides:
collideVertical in class ToTile4Movement

copy

public Movement copy(Actor actor)
Description copied from interface: Movement
Copies the movement.

Specified by:
copy in interface Movement
Returns:
Movement

getName

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

resetLocation

public void resetLocation(int xTile,
                          int yTile)

resetLocation

public void resetLocation(int xTile,
                          int yTile,
                          int lastXTile,
                          int lastYTile)

setFindPaths

public void setFindPaths(FindPathsFourWay findPaths,
                         Sprite target)

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
Overrides:
update in class ToTile4Movement
Parameters:
elapseTime - long

markTileReached

protected void markTileReached()
Specified by:
markTileReached in class ToTile4Movement

getDirectionEnum

protected GameVector.DIRECTION getDirectionEnum()
Specified by:
getDirectionEnum in class ToTile4Movement