CCActionSequence Class Reference

Inherits from CCActionInterval : CCActionFiniteTime : CCAction : NSObject
Conforms to NSCopying
Declared in CCActionInterval.h

Overview

This action allows actions to be executed sequentially, meaning one after another.

Usage example with action1 through action3 being already declared actions which directly or indirectly inherit from CCActionFiniteTime:

NSArray* actionsArray = @[action1, action2, action3];
id sequence = [CCActionSequence actionsWithArray:actionsArray];
[self runAction:sequence];

The traditional way still works, is less verbose but potentially dangerous, see warning below:

id sequence = [CCActionSequence actions:action1, action2, action3, nil];
[self runAction:sequence];

Warning: Terminating the actions: list with nil is mandatory. Failure to do so will result in a compiler warning: “Missing sentinal in method dispatch”. If you run the app anyway it will cause a crash (EXC_BAD_ACCESS) when creating the sequence.

Note: In order to spawn multiple actions at the same time from within the sequence, use CCActionSpawn.

Creating a Sequence Action

+ actions:

Helper constructor to create an array of sequence-able actions.

+ (id)actions:(CCActionFiniteTime *)action1, ...

Parameters

action1

First action to add to sequence.

...

nil-terminated list of actions to sequence.

Return Value

A New action sequence.

Discussion

Warning: List must be nil-terminated. Not doing so results in “Missing sentinal in method dispatch” warning, which will crash the app if ignored.

Declared In

CCActionInterval.h

+ actions:vaList:

Helper constructor to create an array of sequence-able actions.

+ (id)actions:(CCActionFiniteTime *)action1 vaList:(va_list)args

Parameters

action1

Action to sequence.

args

C/C++ variadic arguments list (va_list) of actions.

Return Value

New action sequence.

Discussion

Note: The usual C/C++ memory management and va_list usage principles apply.

Declared In

CCActionInterval.h

+ actionWithArray:

Helper constructor to create an array of sequence-able actions given an array. Recommended, safe initializer.

+ (id)actionWithArray:(NSArray *)arrayOfActions

Parameters

arrayOfActions

Array of actions to sequence.

Return Value

New action sequence.

Declared In

CCActionInterval.h