Class: ActionsList

b5. ActionsList

b5.ActionsList

new b5.ActionsList(name, repeat){b5.ActionsList}

core/actions.js, line 86

An action is a single unit of functionality that can be applied to an object. Generally actions are chained together and added to a b5.Actor or b5.Scene to modify their behaviour Each action has a set of initial parameters which are supplied externally as well as the following event handlers:

  • onInit - Called when the action is first initialised, usually when the action is added to an object
  • onTick - Called when the action is updated (each game frame)

If the onTick handler is not supplied then the action system will assume that it instantly exits and moves to the next action in the actions list

An ActionsList contains a list of actions that are executed in sequence. Each action must fully complete (return false from its onTick method) before the next action can be executed. An action list can be executed a finite number of times or indefinitely.

Each time an actions list is repeated, all actions within the list will be re-initialised.

Example showing how to add two sequential actions to an actor:

 var actions_list = new b5.ActionsList("moveme", 0);
 actions_list.add(new b5.ActionMoveTo(actor,100,100,2,b5.Ease.sin,b5.Ease.sin));
 actions_list.add(new b5.ActionMoveTo(actor,0,0,2,b5.Ease.sin,b5.Ease.sin));
 actor.actions.add(actions_list).play();

For a complete overview of Actions see Booty5 Actions Overview

Name Type Description
name string

Name of actions list

repeat boolean

Number of times that the actions list should repeat (0 for forever)

Properties:
Name Type Description
repeats_left number

Number of repeats left before action list ends (interval)

manager b5.ActionsListManager

Parent actions list manager

name string

Name of this actions list

repeat boolean

Number of times the actions list should repeat

actions Array.<object>

List of actions to sequentially execute

current number

Current executing action index

destroy boolean

If true then actions list will be destroyed when it finishes playing (default is true)

playing boolean

Playing state (default is false)

Returns:
Type Description
b5.ActionsList The created actions list

Methods

add(action){object}

core/actions.js, line 106

Add the specified action to the actions list

Name Type Description
action object

Action to add

Returns:
Type Description
object The added action

execute(){boolean}

core/actions.js, line 135

Executes this actions list, automatically called by the actions list manager

Returns:
Type Description
boolean True if the action is still processing, false if it has stopped

pause()

core/actions.js, line 179

Pauses playback of the actions list

play()

core/actions.js, line 187

Sets the actions list playing, if actions list is paused then it will be un-paused

remove(action)

core/actions.js, line 117

Removes the specified action from the actions list

Name Type Description
action object

The action to remove

restart()

core/actions.js, line 195

Restarts the actions list restarting all actions contained within it