gameaction
Class Walk

java.lang.Object
  extended by gameaction.AbstractGameAction
      extended by gameaction.Walk
All Implemented Interfaces:
java.io.Serializable

public class Walk
extends AbstractGameAction

A game action that represents walking to a new point in the game location

Author:
Frank Bruns
See Also:
Serialized Form

Constructor Summary
Walk(AbstractCharacterSprite c, int goToX, int goToY)
          Creates a new walking event with the specified coordinates that provide the target location of the walking event
Walk(AbstractCharacterSprite c, Path path)
          Creates a new walking event with the specified coordinates that provide the target location of the walking event
 
Method Summary
 double getTargetX()
          Returns the x-coordinate of the walking target position
 double getTargetY()
          Returns the y-coordinate of the walking target position
 boolean hasArrivedAtTarget()
          Returns whether the character has arrived at its designated target location.
 void update(long elapsedTime)
          Updates the game action
 
Methods inherited from class gameaction.AbstractGameAction
getCharacter, isSecondMethodCall
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Walk

public Walk(AbstractCharacterSprite c,
            int goToX,
            int goToY)
Creates a new walking event with the specified coordinates that provide the target location of the walking event

Parameters:
c - the character that walks
goToX - target x-coordinate for the walking event
goToY - target y-coordinate for the walking event

Walk

public Walk(AbstractCharacterSprite c,
            Path path)
Creates a new walking event with the specified coordinates that provide the target location of the walking event

Parameters:
c - the character that walks
path - path to walk for the character
Method Detail

getTargetX

public double getTargetX()
Returns the x-coordinate of the walking target position

Returns:
target x-coordinate

getTargetY

public double getTargetY()
Returns the y-coordinate of the walking target position

Returns:
target y-coordinate

hasArrivedAtTarget

public boolean hasArrivedAtTarget()
Returns whether the character has arrived at its designated target location.

Returns:
has arrived at target location? --> true=yes, false=no

update

public void update(long elapsedTime)
Description copied from class: AbstractGameAction
Updates the game action

Specified by:
update in class AbstractGameAction
Parameters:
elapsedTime - time between two frames