net.nexttext.behaviour.standard
Class MoveTo

java.lang.Object
  extended by net.nexttext.behaviour.AbstractAction
      extended by net.nexttext.behaviour.standard.MoveTo
All Implemented Interfaces:
Action, TargetingAction

public class MoveTo
extends AbstractAction
implements TargetingAction

Move an object to the location.


Nested Class Summary
 
Nested classes/interfaces inherited from interface net.nexttext.behaviour.Action
Action.ActionResult
 
Constructor Summary
MoveTo(int x, int y)
          Move a TextObject to a specified position.
MoveTo(int x, int y, long speed)
          Move a TextObject to a specified position at a certain speed.
MoveTo(Locatable target)
          Move a TextObject to a target.
MoveTo(Locatable target, long speed)
          Move a TextObject to a target at a certain speed.
MoveTo(processing.core.PVector target)
          Move a TextObject to a target.
MoveTo(processing.core.PVector target, long speed)
          Move a TextObject to a specified position.
 
Method Summary
 Action.ActionResult behave(TextObject to)
          Add a vector to the position to bring it closer to the target.
 void setTarget(float x, float y)
          Sets a target to approach.
 void setTarget(float x, float y, float z)
          Sets a target to approach.
 void setTarget(Locatable target)
          Sets a target to approach.
 void setTarget(processing.core.PVector target)
          Sets a target to approach.
 
Methods inherited from class net.nexttext.behaviour.AbstractAction
behave, behave, complete, getDisplayName, getRequiredProperties, makeBehaviour, properties, setDisplayName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.nexttext.behaviour.Action
behave, behave, complete, getRequiredProperties
 

Constructor Detail

MoveTo

public MoveTo(int x,
              int y)
Move a TextObject to a specified position.

Parameters:
x - x target position
y - y target position

MoveTo

public MoveTo(int x,
              int y,
              long speed)
Move a TextObject to a specified position at a certain speed.

Parameters:
x - x target position
y - x target position
speed - moving speed

MoveTo

public MoveTo(Locatable target)
Move a TextObject to a target.

Parameters:
target - locatable target

MoveTo

public MoveTo(Locatable target,
              long speed)
Move a TextObject to a target at a certain speed.

Parameters:
target - locatable target
speed - The speed of the approach represented as the number of pixels to move in each frame. Use a very large number for instant travel.

MoveTo

public MoveTo(processing.core.PVector target)
Move a TextObject to a target.

Parameters:
target - locatable target

MoveTo

public MoveTo(processing.core.PVector target,
              long speed)
Move a TextObject to a specified position.

Parameters:
target - position to move to
speed - The speed of the approach represented as the number of pixels to move in each frame. Use a very large number for instant travel.
Method Detail

behave

public Action.ActionResult behave(TextObject to)
Add a vector to the position to bring it closer to the target.

Result is complete if it has reached its target.

Specified by:
behave in interface Action
Overrides:
behave in class AbstractAction

setTarget

public void setTarget(Locatable target)
Sets a target to approach.

Specified by:
setTarget in interface TargetingAction

setTarget

public void setTarget(float x,
                      float y)
Sets a target to approach.

Specified by:
setTarget in interface TargetingAction

setTarget

public void setTarget(float x,
                      float y,
                      float z)
Sets a target to approach.

Specified by:
setTarget in interface TargetingAction

setTarget

public void setTarget(processing.core.PVector target)
Sets a target to approach.

Specified by:
setTarget in interface TargetingAction