CCAction Class Reference
Inherits from | NSObject |
---|---|
Conforms to | NSCopying |
Declared in | CCAction.h |
Overview
CCAction is an abstract base class for all actions. Actions animate nodes by manipulating node properties over time such as position, rotation, scale and opacity.
For more information see the Concepts:Actions article in the Developer Guide
Subclasses
The following actions inherit directly from CCAction and can be used “as is”:
- CCActionFollow (parent node follows the target node’s movement)
- CCActionRepeatForever (runs a CCActionInterval in an endless loop until stopped)
- CCActionSpeed (modifies the speed of a CCActionInterval action while it is running)
These action subclasses are abstract base classes for instant and “over time” actions, see their references for more information:
Creating an Action
+ action
Creates and returns an action.
+ (id)action
Return Value
The CCAction Object.
Discussion
Warning: If a CCAction subclass provides designated initializers you will have to use those over this one.
Declared In
CCAction.h
Action Targets
target
The “target” is typically the node instance that received the [CCNode runAction:] message. The action will modify the target properties. The target will be set with the ‘startWithTarget’ method. When the ‘stop’ method is called, target will be set to nil.
@property (nonatomic, readonly, unsafe_unretained) id target
Discussion
Warning: The target is ‘assigned’ (unsafe unretained), it is not ‘retained’ nor managed by ARC.
Declared In
CCAction.h
Identifying an Action
Action Methods Implemented by Subclasses
– isDone
Return YES if the action has finished.
- (BOOL)isDone
Return Value
Action completion status
Declared In
CCAction.h
– stop
Stops the action Called after the action has finished. Will assign the internal target reference to nil. Note: You should never call this method directly. In stead use: [target stopAction:action]
- (void)stop
Declared In
CCAction.h