libgdx API

com.badlogic.gdx.scenes.scene2d
Class Action

java.lang.Object
  extended by com.badlogic.gdx.scenes.scene2d.Action
Direct Known Subclasses:
AnimationAction, CompositeAction, Delay, Remove, TemporalAction

public abstract class Action
extends java.lang.Object

An Action is used with an Actor and modifes the Actor's attributes over time.

Author:
mzechner

Field Summary
protected  OnActionCompleted listener
           
 
Constructor Summary
Action()
           
 
Method Summary
abstract  void act(float delta)
          Apply the action.
 void callActionCompletedListener()
          Calls the OnActionCompleted listener and sets it to null so it won't be called again.
abstract  Action copy()
          Creates a copy of this action.
 void finish()
          Called by the owner of the action when it can release all its resources, e.g.
 OnActionCompleted getCompletionListener()
           
abstract  Actor getTarget()
           
abstract  boolean isDone()
           
 void reset()
          Sets the Action back to a vanilla state.
 Action setCompletionListener(OnActionCompleted listener)
          Sets the listener to be invoked when the action is finished.
abstract  void setTarget(Actor actor)
          Sets the Actor of this action.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

listener

protected OnActionCompleted listener
Constructor Detail

Action

public Action()
Method Detail

setTarget

public abstract void setTarget(Actor actor)
Sets the Actor of this action. Will be called when the Action is added to an Actor via Actor.action(Action) before any other call to this interface.

Parameters:
actor - the actor.

getTarget

public abstract Actor getTarget()
Returns:
the Actor this action targets.

act

public abstract void act(float delta)
Apply the action.

Parameters:
delta - delta time in seconds

isDone

public abstract boolean isDone()
Returns:
whether the action is done or not

finish

public void finish()
Called by the owner of the action when it can release all its resources, e.g. put itself back into a pool.


callActionCompletedListener

public void callActionCompletedListener()
Calls the OnActionCompleted listener and sets it to null so it won't be called again.


copy

public abstract Action copy()
Creates a copy of this action. The action must be in a state independent of the original and one must be able to call setTarget(Actor) on it without any side effects.


setCompletionListener

public Action setCompletionListener(OnActionCompleted listener)
Sets the listener to be invoked when the action is finished.

Parameters:
listener -
Returns:
this

getCompletionListener

public OnActionCompleted getCompletionListener()
Returns:
the OnActionCompleted listener or null.

reset

public void reset()
Sets the Action back to a vanilla state.


libgdx API

Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)