org.newdawn.asd.data.actions
Class PathFollowAction

java.lang.Object
  extended byorg.newdawn.asd.data.actions.MoveAction
      extended byorg.newdawn.asd.data.actions.PathFollowAction
All Implemented Interfaces:
Action

public class PathFollowAction
extends MoveAction
implements Action

An action that will attempt to find a path to a particular location and then follow it.


Field Summary
protected  boolean considerActors
          Consider actors when moving
protected  boolean movingToTarget
          True if we've moving to the target
protected  Path path
          The current path being followed
protected  boolean pathNeedsUpdate
          True if the path needs updating
protected  int point
          The point on the path that is being tended towards
protected  int startPoint
          The first point on the path to use
protected  float targetx
          The point we're moving towards
protected  float targety
          The point we're moveint towards
protected  int tilNextPathFind
          The time until we can cause a path find again
 
Fields inherited from class org.newdawn.asd.data.actions.MoveAction
oldAction, x, y
 
Constructor Summary
PathFollowAction(float targetx, float targety)
          Create a new action
 
Method Summary
 void act(Map map, Actor actor, int delta)
          Invoke this action
 int getChecksum()
          Retrieve a checksum for this action
protected  void handleBlocked(Actor actor, float dx, float dy)
          Handler for when the actor is blocked from making any move in the right direction.
protected  void handleReachedTarget(Actor actor, float dx, float dy)
          Handler for when the actor reaches the current target
 
Methods inherited from class org.newdawn.asd.data.actions.MoveAction
handlePossibleBlocked, setTarget
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tilNextPathFind

protected int tilNextPathFind
The time until we can cause a path find again


path

protected Path path
The current path being followed


targetx

protected float targetx
The point we're moving towards


targety

protected float targety
The point we're moveint towards


point

protected int point
The point on the path that is being tended towards


pathNeedsUpdate

protected boolean pathNeedsUpdate
True if the path needs updating


movingToTarget

protected boolean movingToTarget
True if we've moving to the target


considerActors

protected boolean considerActors
Consider actors when moving


startPoint

protected int startPoint
The first point on the path to use

Constructor Detail

PathFollowAction

public PathFollowAction(float targetx,
                        float targety)
Create a new action

Parameters:
targetx - The target we're hoping to get to eventually
targety - The target we're hoping to get to eventually
Method Detail

act

public void act(Map map,
                Actor actor,
                int delta)
Description copied from interface: Action
Invoke this action

Specified by:
act in interface Action
Overrides:
act in class MoveAction
See Also:
Action.act(org.newdawn.asd.data.Map, org.newdawn.asd.data.Actor, int)

getChecksum

public int getChecksum()
Description copied from interface: Action
Retrieve a checksum for this action

Specified by:
getChecksum in interface Action
Overrides:
getChecksum in class MoveAction
See Also:
Action.getChecksum()

handleBlocked

protected void handleBlocked(Actor actor,
                             float dx,
                             float dy)
Description copied from class: MoveAction
Handler for when the actor is blocked from making any move in the right direction.

Overrides:
handleBlocked in class MoveAction
Parameters:
actor - The actor that was moving
dx - The ammount on the x-axis that was moved
dy - The ammount on the y-axis that was moved
See Also:
MoveAction.handleBlocked(org.newdawn.asd.data.Actor, float, float)

handleReachedTarget

protected void handleReachedTarget(Actor actor,
                                   float dx,
                                   float dy)
Description copied from class: MoveAction
Handler for when the actor reaches the current target

Overrides:
handleReachedTarget in class MoveAction
Parameters:
actor - The actor that was being moved
dx - The direction on the x-axis that was moved last
dy - The direction on the y-axis that was moved last
See Also:
MoveAction.handleReachedTarget(org.newdawn.asd.data.Actor, float, float)