Working with Actions Lists


Actions Introduction

The Booty5 editor / engine utilises a feature called Actions which can be used to add additional functionality to scenes and game object actors without having to resort to programming. Whilst actions are not a direct replacement for programming they can help someone with little to no coding experience to add functionality very easily. In addition, you can add your own custom actions to add in extra common functionality that is shared across your games, enabling none programmers to add functionality without the need to code.

An action is a single unit of functionality that affects an object or performs a task, for example moving an object from point A to B or playing a sound effect. Booty5 comes with a collection of pre-made actions that can be chained together to create complex object behaviours that are fired when certain events take place during the game. Actions are presented in the Booty5 editor in human readable format.

To give you can idea what actions look like a couple of example actions are listed below:

  • Move object my_object to position 100,100 over 2 seconds using x-axis linear easing and y-axis quartic in easing
  • Stop moving object my_object on x-axis and y-axis after 3 seconds
  • Object my_object follows path with shape shape1 starting at distance 10 at speed 1 adjusting angle
  • Object my_object follows object my_object2 at speed 10 at minimum distance 50

Each scene and actor can have its own actions list

Actions Lists

Actions lists are collections of actions that are executed one action at a time, the action list will not move on to the next action until the current action has finished executing. So for example, if we move an object from position a to b over 5 seconds, the next action will not run until 5 seconds has passed. You can run actions simultaneously by putting the actions is a separate list and playing that list at the same time.

Actors and scenes have their own local action lists which are ran whilst the object is active (paused with inactive) and destroyed when the object is destroyed.

The resource properties section of the actor / scene at the right hand side of the display contains an Actions List section, which enables you to create and delete action lists for each object. Each actions list has a name, a repeats (number of times the action list is repeated before stopping), an auto-play check-box and an edit button. If the auto-play check-box is enabled then the actions list will automatically begin executing as soon as the object is created.

To edit an objects actions list click the edit button at the side of the actions list in the objects properties panel, this will open an actions list editor window which looks like the image below:

Booty5 HTML5 Actions Editor

Booty5 HTML5 Actions Editor

The actions list editor window is split into 3 sections:

  • Actions – Displays all available actions, separated by category. To find out more information, select an action and information about the action will be displayed to the right. To add an action to the actions list, click the ‘+’ button next to the action
  • Actions information – Displays in-depth information about the action currently selected in the actions / actions list sections
  • Actions list – A list of actions that will be executed in the order in which they appear in the list. This section also contains 4 buttons which can be used to delete, move up / down actions and get additional help

Editing Actions Lists

You can add an action to the actions list by clicking the ‘+’ button that is situated at the side of the action in the action view. This will append the action onto the end of the actions list. If you wish to change the order of execution of any of the actions then you should select the action and use the up / down buttons to change the order.

Each action has its own unique set of parameters that can be changed, some are presented as text boxes, drop down lists or check boxes. Usually when the action requires some kind of object argument you can type a path to the object directly into the text box or click the ‘…’ button at the side of the text box and select from a list of available objects of the required type.

If an action requires some kind of properties list then you should enter properties in the following format:

x=10,y=20,vx=-10,vy=-50

Resource Paths

Many actions allow you to specify a path to an object, usually you are presented with a button to select the object from a list of available resources. This path represents the hierarchical path to the object which consists of the names of the parent objects separated by dots. For example, if you want to use an actions list called “start_game” that is located in an actor called “start_button” which is located inside a scene called “mainmenu” then the path to this object would be mainmenu.start_button.start_game. This same kind of path location convention is used within the Booty5 engine itself and can be used from JavaScript.

Creating an Actions List Walk-through

Here is a quick example that walks through the creation of an actions list:

  • Start a new project
  • Right click on the scene in the world tree and add a new sprite
  • Select the new sprite by clicking on it on the central canvas
  • Scroll down to the Actions List section and “+” button that is located in that section to add a new actions list.
  • Enter a name for the actions list and tick the “Play” check box to ensure that it auto-plays
  • Click the “Edit” button at the side of the actions list to go to the actions list editor
  • Select the “Movement” tab in the actions view, this will show a collection of actions that are related to object movement
  • Click the “+” button at the side of the “MoveTo” action, this will add a new action to the actions list
  • Change the position property in the action to 100,100 and the time to value to 5
  • Click the “+” button at the side of the “MoveTo” action again, this will add another new action to the actions list
  • Change the position property in the action to -200,100 and the time to value to 2
  • Exit the actions list editor and click the “Test” button to launch the game. The object will be seen moving to position 100,100 over 5 seconds, then will move to -200,100 over 2 second.

Next Topic:

1,070 total views, 4 views today