Cocos2d-x  v3.16
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups Pages
Action Class Reference

Base class for Action objects. More...

Inherits Ref, and Clonable.

Inherited by FiniteTimeAction, Follow, and Speed.

Public Member Functions

virtual Actionclone () const
 Returns a clone of action. More...
 
local clone ()
 Returns a clone of action. More...
 
virtual Actionreverse () const
 Returns a new action that performs the exact reverse of the action. More...
 
local reverse ()
 Returns a new action that performs the exact reverse of the action. More...
 
virtual bool isDone () const
 Return true if the action has finished. More...
 
local isDone ()
 Return true if the action has finished. More...
 
virtual void startWithTarget (Node *target)
 Called before the action start. More...
 
local startWithTarget ( local target)
 Called before the action start. More...
 
virtual void stop ()
 Called after the action has finished. More...
 
var stop ()
 Called after the action has finished. More...
 
local stop ()
 Called after the action has finished. More...
 
virtual void step (float dt)
 Called every frame with it's delta time, dt in seconds. More...
 
local step ( local dt)
 Called every frame with it's delta time, dt in seconds. More...
 
virtual void update (float time)
 Called once per frame. More...
 
NodegetTarget () const
 Return certain target. More...
 
var getTarget ()
 Return certain target. More...
 
local getTarget ()
 Return certain target. More...
 
void setTarget (Node *target)
 The action will modify the target properties. More...
 
var setTarget ( var target)
 The action will modify the target properties. More...
 
local setTarget ( local target)
 The action will modify the target properties. More...
 
NodegetOriginalTarget () const
 Return a original Target. More...
 
var getOriginalTarget ()
 Return a original Target. More...
 
local getOriginalTarget ()
 Return a original Target. More...
 
void setOriginalTarget (Node *originalTarget)
 Set the original target, since target can be nil. More...
 
var setOriginalTarget ( var originalTarget)
 Set the original target, since target can be nil. More...
 
local setOriginalTarget ( local originalTarget)
 Set the original target, since target can be nil. More...
 
int getTag () const
 Returns a tag that is used to identify the action easily. More...
 
var getTag ()
 Returns a tag that is used to identify the action easily. More...
 
local getTag ()
 Returns a tag that is used to identify the action easily. More...
 
void setTag (int tag)
 Changes the tag that is used to identify the action easily. More...
 
var setTag ( var tag)
 Changes the tag that is used to identify the action easily. More...
 
local setTag ( local tag)
 Changes the tag that is used to identify the action easily. More...
 
unsigned int getFlags () const
 Returns a flag field that is used to group the actions easily. More...
 
void setFlags (unsigned int flags)
 Changes the flag field that is used to group the actions easily. More...
 
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
void release ()
 Releases the ownership immediately. More...
 
local release ()
 Releases the ownership immediately. More...
 
Refautorelease ()
 Releases the ownership sometime soon automatically. More...
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count. More...
 
local getReferenceCount ()
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()
 Destructor. More...
 
- Public Member Functions inherited from Clonable
Refcopy () const
 Returns a copy of the Ref. More...
 

Static Public Attributes

static const int INVALID_TAG = -1
 Default tag used for all the actions. More...
 
var INVALID_TAG = -1
 Default tag used for all the actions. More...
 
local INVALID_TAG = -1
 Default tag used for all the actions. More...
 

Additional Inherited Members

- Public Attributes inherited from Ref
unsigned int _ID
 object id, ScriptSupport need public _ID
 
local _ID
 object id, ScriptSupport need public _ID
 
int _luaID
 Lua reference id.
 
local _luaID
 Lua reference id.
 
void * _scriptObject
 scriptObject, support for swift
 
local _scriptObject
 scriptObject, support for swift
 
bool _rooted
 When true, it means that the object was already rooted.
 
local _rooted
 When true, it means that the object was already rooted.
 

Detailed Description

Base class for Action objects.

Member Function Documentation

virtual Action* clone ( ) const
inlinevirtual

Returns a clone of action.

Returns
A clone action.

Implements Clonable.

Reimplemented in ActionFloat, TargetedAction, Animate, ReverseTime, DelayTime, TintBy, TintTo, FadeOut, FadeIn, FadeTo, Blink, ScaleBy, ScaleTo, BezierTo, BezierBy, JumpTo, JumpBy, ResizeBy, ResizeTo, SkewBy, SkewTo, MoveTo, MoveBy, Twirl, SplitCols, RotateBy, SplitRows, EaseBezierAction, EaseElasticInOut, EaseElasticOut, Waves, JumpTiles3D, EaseElasticIn, RotateTo, CallFuncN, Liquid, WavesTiles3D, EaseInOut, ReuseGrid, Spawn, EaseOut, EaseIn, StopGrid, CallFunc, Follow, EaseCubicActionInOut, Shaky3D, EaseCubicActionOut, TurnOffTiles, EaseCubicActionIn, EaseCircleActionInOut, DeccelAmplitude, EaseCircleActionOut, CatmullRomBy, EaseCircleActionIn, EaseQuinticActionInOut, RepeatForever, EaseQuinticActionOut, EaseQuinticActionIn, Ripple3D, FadeOutDownTiles, EaseQuarticActionInOut, Place, CatmullRomTo, EaseQuarticActionOut, AccelAmplitude, EaseQuarticActionIn, EaseQuadraticActionInOut, Speed, FadeOutUpTiles, EaseQuadraticActionOut, EaseQuadraticActionIn, CardinalSplineBy, FlipY, EaseBackInOut, EaseBackOut, Repeat, FadeOutBLTiles, AccelDeccelAmplitude, EaseBackIn, EaseBounceInOut, FlipX, FadeOutTRTiles, Lens3D, EaseBounceOut, CardinalSplineTo, FiniteTimeAction, EaseBounceIn, TiledGrid3DAction, EaseSineInOut, RemoveSelf, EaseSineOut, Sequence, EaseSineIn, EaseExponentialInOut, FlipY3D, ToggleVisibility, EaseExponentialOut, ShuffleTiles, EaseExponentialIn, OrbitCamera, Grid3DAction, Hide, FlipX3D, LuaCallFunc, ActionInterval, ShatteredTiles3D, ProgressFromTo, ActionTween, Show, Animate3D, Waves3D, ActionCamera, PageTurn3D, GridAction, ProgressTo, ShakyTiles3D, and ActionInstant.

var clone ( )
inlinevirtual

Returns a clone of action.

Returns
A clone action.

Implements Clonable.

Reimplemented in ActionFloat, TargetedAction, Animate, ReverseTime, DelayTime, TintBy, TintTo, FadeOut, FadeIn, FadeTo, Blink, ScaleBy, ScaleTo, BezierTo, BezierBy, JumpTo, JumpBy, ResizeBy, ResizeTo, SkewBy, SkewTo, MoveTo, MoveBy, Twirl, SplitCols, RotateBy, SplitRows, EaseBezierAction, EaseElasticInOut, EaseElasticOut, Waves, JumpTiles3D, EaseElasticIn, RotateTo, CallFuncN, Liquid, WavesTiles3D, EaseInOut, ReuseGrid, Spawn, EaseOut, EaseIn, StopGrid, CallFunc, Follow, EaseCubicActionInOut, Shaky3D, EaseCubicActionOut, TurnOffTiles, EaseCubicActionIn, EaseCircleActionInOut, DeccelAmplitude, EaseCircleActionOut, CatmullRomBy, EaseCircleActionIn, EaseQuinticActionInOut, RepeatForever, EaseQuinticActionOut, EaseQuinticActionIn, Ripple3D, FadeOutDownTiles, EaseQuarticActionInOut, Place, CatmullRomTo, EaseQuarticActionOut, AccelAmplitude, EaseQuarticActionIn, EaseQuadraticActionInOut, Speed, FadeOutUpTiles, EaseQuadraticActionOut, EaseQuadraticActionIn, CardinalSplineBy, FlipY, EaseBackInOut, EaseBackOut, Repeat, FadeOutBLTiles, AccelDeccelAmplitude, EaseBackIn, EaseBounceInOut, FlipX, FadeOutTRTiles, Lens3D, EaseBounceOut, CardinalSplineTo, FiniteTimeAction, EaseBounceIn, TiledGrid3DAction, EaseSineInOut, RemoveSelf, EaseSineOut, Sequence, EaseSineIn, EaseExponentialInOut, FlipY3D, ToggleVisibility, EaseExponentialOut, ShuffleTiles, EaseExponentialIn, OrbitCamera, Grid3DAction, Hide, FlipX3D, LuaCallFunc, ActionInterval, ShatteredTiles3D, ProgressFromTo, ActionTween, Show, Animate3D, Waves3D, ActionCamera, PageTurn3D, GridAction, ProgressTo, ShakyTiles3D, and ActionInstant.

local clone ( )
inlinevirtual

Returns a clone of action.

Returns
A clone action.

Implements Clonable.

Reimplemented in ActionFloat, TargetedAction, Animate, ReverseTime, DelayTime, TintBy, TintTo, FadeOut, FadeIn, FadeTo, Blink, ScaleBy, ScaleTo, BezierTo, BezierBy, JumpTo, JumpBy, ResizeBy, ResizeTo, SkewBy, SkewTo, MoveTo, MoveBy, Twirl, SplitCols, RotateBy, SplitRows, EaseBezierAction, EaseElasticInOut, EaseElasticOut, Waves, JumpTiles3D, EaseElasticIn, RotateTo, CallFuncN, Liquid, WavesTiles3D, EaseInOut, ReuseGrid, Spawn, EaseOut, EaseIn, StopGrid, CallFunc, Follow, EaseCubicActionInOut, Shaky3D, EaseCubicActionOut, TurnOffTiles, EaseCubicActionIn, EaseCircleActionInOut, DeccelAmplitude, EaseCircleActionOut, CatmullRomBy, EaseCircleActionIn, EaseQuinticActionInOut, RepeatForever, EaseQuinticActionOut, EaseQuinticActionIn, Ripple3D, FadeOutDownTiles, EaseQuarticActionInOut, Place, CatmullRomTo, EaseQuarticActionOut, AccelAmplitude, EaseQuarticActionIn, EaseQuadraticActionInOut, Speed, FadeOutUpTiles, EaseQuadraticActionOut, EaseQuadraticActionIn, CardinalSplineBy, FlipY, EaseBackInOut, EaseBackOut, Repeat, FadeOutBLTiles, AccelDeccelAmplitude, EaseBackIn, EaseBounceInOut, FlipX, FadeOutTRTiles, Lens3D, EaseBounceOut, CardinalSplineTo, FiniteTimeAction, EaseBounceIn, TiledGrid3DAction, EaseSineInOut, RemoveSelf, EaseSineOut, Sequence, EaseSineIn, EaseExponentialInOut, FlipY3D, ToggleVisibility, EaseExponentialOut, ShuffleTiles, EaseExponentialIn, OrbitCamera, Grid3DAction, Hide, FlipX3D, LuaCallFunc, ActionInterval, ShatteredTiles3D, ProgressFromTo, ActionTween, Show, Animate3D, Waves3D, ActionCamera, PageTurn3D, GridAction, ProgressTo, ShakyTiles3D, and ActionInstant.

virtual bool isDone ( ) const
virtual

Return true if the action has finished.

Returns
Is true if the action has finished.

Reimplemented in Follow, RepeatForever, Speed, Repeat, Sequence, ActionInterval, and ActionInstant.

var isDone ( )
virtual

Return true if the action has finished.

Returns
Is true if the action has finished.

Reimplemented in Follow, RepeatForever, Speed, Repeat, Sequence, ActionInterval, and ActionInstant.

local isDone ( )
virtual

Return true if the action has finished.

Returns
Is true if the action has finished.

Reimplemented in Follow, RepeatForever, Speed, Repeat, Sequence, ActionInterval, and ActionInstant.

virtual void stop ( )
virtual

Called after the action has finished.

It will set the 'target' to nil. IMPORTANT: You should never call "Action::stop()" manually. Instead, use: "target->stopAction(action);".

Reimplemented in TargetedAction, Animate, ReverseTime, Blink, Spawn, Follow, Speed, Repeat, Sequence, Animate3D, and ActionEase.

var stop ( )
virtual

Called after the action has finished.

It will set the 'target' to nil. IMPORTANT: You should never call "Action::stop()" manually. Instead, use: "target->stopAction(action);".

Reimplemented in TargetedAction, Animate, ReverseTime, Blink, Spawn, Follow, Speed, Repeat, Sequence, Animate3D, and ActionEase.

local stop ( )
virtual

Called after the action has finished.

It will set the 'target' to nil. IMPORTANT: You should never call "Action::stop()" manually. Instead, use: "target->stopAction(action);".

Reimplemented in TargetedAction, Animate, ReverseTime, Blink, Spawn, Follow, Speed, Repeat, Sequence, Animate3D, and ActionEase.

virtual void step ( float  dt)
virtual

Called every frame with it's delta time, dt in seconds.

DON'T override unless you know what you are doing.

Parameters
dtIn seconds.

Reimplemented in Follow, RepeatForever, Speed, ActionInterval, Animate3D, and ActionInstant.

var step ( var  dt)
virtual

Called every frame with it's delta time, dt in seconds.

DON'T override unless you know what you are doing.

Parameters
dtIn seconds.

Reimplemented in Follow, RepeatForever, Speed, ActionInterval, Animate3D, and ActionInstant.

local step ( local  dt)
virtual

Called every frame with it's delta time, dt in seconds.

DON'T override unless you know what you are doing.

Parameters
dtIn seconds.

Reimplemented in Follow, RepeatForever, Speed, ActionInterval, Animate3D, and ActionInstant.

virtual void update ( float  time)
virtual

Called once per frame.

time a value between 0 and 1.

For example:

  • 0 Means that the action just started.
  • 0.5 Means that the action is in the middle.
  • 1 Means that the action is over.
Parameters
timeA value between 0 and 1.

Reimplemented in ActionFloat, TargetedAction, Animate, ReverseTime, DelayTime, TintBy, TintTo, FadeTo, Blink, ScaleTo, BezierBy, JumpBy, ResizeBy, ResizeTo, SkewTo, MoveBy, Twirl, SplitCols, RotateBy, SplitRows, EaseBezierAction, EaseElasticInOut, EaseElasticOut, Waves, JumpTiles3D, EaseElasticIn, RotateTo, Liquid, WavesTiles3D, Spawn, EaseInOut, EaseOut, EaseIn, CallFunc, EaseCubicActionInOut, Shaky3D, TurnOffTiles, EaseCubicActionOut, EaseCubicActionIn, EaseCircleActionInOut, DeccelAmplitude, EaseCircleActionOut, EaseCircleActionIn, EaseQuinticActionInOut, EaseQuinticActionOut, Ripple3D, EaseQuinticActionIn, EaseQuarticActionInOut, Place, EaseQuarticActionOut, AccelAmplitude, EaseQuarticActionIn, EaseQuadraticActionInOut, EaseQuadraticActionOut, EaseQuadraticActionIn, FlipY, EaseBackInOut, Repeat, EaseBackOut, AccelDeccelAmplitude, EaseBackIn, EaseBounceInOut, CardinalSplineTo, FlipX, Lens3D, FadeOutTRTiles, EaseBounceOut, EaseBounceIn, EaseSineInOut, Sequence, RemoveSelf, EaseSineOut, EaseSineIn, EaseExponentialInOut, FlipY3D, EaseExponentialOut, ToggleVisibility, ShuffleTiles, OrbitCamera, EaseExponentialIn, Hide, FlipX3D, ProgressFromTo, ShatteredTiles3D, ActionTween, Show, Animate3D, Waves3D, ActionInstant, PageTurn3D, ActionEase, ProgressTo, and ShakyTiles3D.

var update ( var  time)
virtual

Called once per frame.

time a value between 0 and 1.

For example:

  • 0 Means that the action just started.
  • 0.5 Means that the action is in the middle.
  • 1 Means that the action is over.
Parameters
timeA value between 0 and 1.

Reimplemented in ActionFloat, TargetedAction, Animate, ReverseTime, DelayTime, TintBy, TintTo, FadeTo, Blink, ScaleTo, BezierBy, JumpBy, ResizeBy, ResizeTo, SkewTo, MoveBy, Twirl, SplitCols, RotateBy, SplitRows, EaseBezierAction, EaseElasticInOut, EaseElasticOut, Waves, JumpTiles3D, EaseElasticIn, RotateTo, Liquid, WavesTiles3D, Spawn, EaseInOut, EaseOut, EaseIn, CallFunc, EaseCubicActionInOut, Shaky3D, TurnOffTiles, EaseCubicActionOut, EaseCubicActionIn, EaseCircleActionInOut, DeccelAmplitude, EaseCircleActionOut, EaseCircleActionIn, EaseQuinticActionInOut, EaseQuinticActionOut, Ripple3D, EaseQuinticActionIn, EaseQuarticActionInOut, Place, EaseQuarticActionOut, AccelAmplitude, EaseQuarticActionIn, EaseQuadraticActionInOut, EaseQuadraticActionOut, EaseQuadraticActionIn, FlipY, EaseBackInOut, Repeat, EaseBackOut, AccelDeccelAmplitude, EaseBackIn, EaseBounceInOut, CardinalSplineTo, FlipX, Lens3D, FadeOutTRTiles, EaseBounceOut, EaseBounceIn, EaseSineInOut, Sequence, RemoveSelf, EaseSineOut, EaseSineIn, EaseExponentialInOut, FlipY3D, EaseExponentialOut, ToggleVisibility, ShuffleTiles, OrbitCamera, EaseExponentialIn, Hide, FlipX3D, ProgressFromTo, ShatteredTiles3D, ActionTween, Show, Animate3D, Waves3D, ActionInstant, PageTurn3D, ActionEase, ProgressTo, and ShakyTiles3D.

local update ( local  time)
virtual

Called once per frame.

time a value between 0 and 1.

For example:

  • 0 Means that the action just started.
  • 0.5 Means that the action is in the middle.
  • 1 Means that the action is over.
Parameters
timeA value between 0 and 1.

Reimplemented in ActionFloat, TargetedAction, Animate, ReverseTime, DelayTime, TintBy, TintTo, FadeTo, Blink, ScaleTo, BezierBy, JumpBy, ResizeBy, ResizeTo, SkewTo, MoveBy, Twirl, SplitCols, RotateBy, SplitRows, EaseBezierAction, EaseElasticInOut, EaseElasticOut, Waves, JumpTiles3D, EaseElasticIn, RotateTo, Liquid, WavesTiles3D, Spawn, EaseInOut, EaseOut, EaseIn, CallFunc, EaseCubicActionInOut, Shaky3D, TurnOffTiles, EaseCubicActionOut, EaseCubicActionIn, EaseCircleActionInOut, DeccelAmplitude, EaseCircleActionOut, EaseCircleActionIn, EaseQuinticActionInOut, EaseQuinticActionOut, Ripple3D, EaseQuinticActionIn, EaseQuarticActionInOut, Place, EaseQuarticActionOut, AccelAmplitude, EaseQuarticActionIn, EaseQuadraticActionInOut, EaseQuadraticActionOut, EaseQuadraticActionIn, FlipY, EaseBackInOut, Repeat, EaseBackOut, AccelDeccelAmplitude, EaseBackIn, EaseBounceInOut, CardinalSplineTo, FlipX, Lens3D, FadeOutTRTiles, EaseBounceOut, EaseBounceIn, EaseSineInOut, Sequence, RemoveSelf, EaseSineOut, EaseSineIn, EaseExponentialInOut, FlipY3D, EaseExponentialOut, ToggleVisibility, ShuffleTiles, OrbitCamera, EaseExponentialIn, Hide, FlipX3D, ProgressFromTo, ShatteredTiles3D, ActionTween, Show, Animate3D, Waves3D, ActionInstant, PageTurn3D, ActionEase, ProgressTo, and ShakyTiles3D.

Node* getTarget ( ) const
inline

Return certain target.

Returns
A certain target.
var getTarget ( )
inline

Return certain target.

Returns
A certain target.
local getTarget ( )
inline

Return certain target.

Returns
A certain target.
void setTarget ( Node target)
inline

The action will modify the target properties.

Parameters
targetA certain target.
var setTarget ( var  target)
inline

The action will modify the target properties.

Parameters
targetA certain target.
local setTarget ( local  target)
inline

The action will modify the target properties.

Parameters
targetA certain target.
Node* getOriginalTarget ( ) const
inline

Return a original Target.

Returns
A original Target.
var getOriginalTarget ( )
inline

Return a original Target.

Returns
A original Target.
local getOriginalTarget ( )
inline

Return a original Target.

Returns
A original Target.
void setOriginalTarget ( Node originalTarget)
inline

Set the original target, since target can be nil.

Is the target that were used to run the action. Unless you are doing something complex, like ActionManager, you should NOT call this method. The target is 'assigned', it is not 'retained'.

Since
v0.8.2
Parameters
originalTargetIs 'assigned', it is not 'retained'.
var setOriginalTarget ( var  originalTarget)
inline

Set the original target, since target can be nil.

Is the target that were used to run the action. Unless you are doing something complex, like ActionManager, you should NOT call this method. The target is 'assigned', it is not 'retained'.

Since
v0.8.2
Parameters
originalTargetIs 'assigned', it is not 'retained'.
local setOriginalTarget ( local  originalTarget)
inline

Set the original target, since target can be nil.

Is the target that were used to run the action. Unless you are doing something complex, like ActionManager, you should NOT call this method. The target is 'assigned', it is not 'retained'.

Since
v0.8.2
Parameters
originalTargetIs 'assigned', it is not 'retained'.
int getTag ( ) const
inline

Returns a tag that is used to identify the action easily.

Returns
A tag.
var getTag ( )
inline

Returns a tag that is used to identify the action easily.

Returns
A tag.
local getTag ( )
inline

Returns a tag that is used to identify the action easily.

Returns
A tag.
void setTag ( int  tag)
inline

Changes the tag that is used to identify the action easily.

Parameters
tagUsed to identify the action easily.
var setTag ( var  tag)
inline

Changes the tag that is used to identify the action easily.

Parameters
tagUsed to identify the action easily.
local setTag ( local  tag)
inline

Changes the tag that is used to identify the action easily.

Parameters
tagUsed to identify the action easily.
unsigned int getFlags ( ) const
inline

Returns a flag field that is used to group the actions easily.

Returns
A tag.
var getFlags ( )
inline

Returns a flag field that is used to group the actions easily.

Returns
A tag.
local getFlags ( )
inline

Returns a flag field that is used to group the actions easily.

Returns
A tag.
void setFlags ( unsigned int  flags)
inline

Changes the flag field that is used to group the actions easily.

Parameters
flagsUsed to group the actions easily.
var setFlags ( var  flags)
inline

Changes the flag field that is used to group the actions easily.

Parameters
flagsUsed to group the actions easily.
local setFlags ( local  flags)
inline

Changes the flag field that is used to group the actions easily.

Parameters
flagsUsed to group the actions easily.

Member Data Documentation

const int INVALID_TAG = -1
static

Default tag used for all the actions.

var INVALID_TAG = -1
static

Default tag used for all the actions.

local INVALID_TAG = -1
static

Default tag used for all the actions.


The documentation for this class was generated from the following file: