What are Interactions?

Interactions allow you to assign triggers to play an action. Triggers are based on how a user interacts with that specific layer. Some triggers include tap, press, drag, shake, and many more. 

First, select the trigger that you want to create.
**If you’ve selected a touch trigger (tap, drag, press, and swipe), you need to assign a layer asset to that trigger.

There are three types of actions to trigger:

Play - animation, dialogue, music, sound effect, or sprite

Go To - scene change or external URL

Set - layer and animation values or a variable

What is a Variable?

Variables are used to store data values. Variables are identified by unique names. 

For example, if you’re creating a game that has score, you’d need to create a score variable to hold all the points. The variable name “score” is unique to the layers and animation values. 

How to Create a Variable

First select “Set” for your action and then select “Variable” from the drop down list and select “+ New Variable.” Then, type the variable that you’d like to create and save. Once it’s saved, you can refer to this variable while you build your logic flow. 

Here’s an example of creating a score variable:

Once you’ve declared your variable, you can assign values in the “Equal To” box. First, you need to select a value (layer, animation, or text) or a variable to show what the variable (unique identifier) is equal to. Also, you can add additional operators like addition, subtraction, multiplication, and division to create an expression. 

At the end of each card, you can add another action or create a condition (an if, else statement). 

What is a Condition? 

Conditions also known as an If, else statement allows you to perform different actions for different decisions. 

If is executed when the condition is true,
else
is executed when the condition is false

Create your If statement by selecting a value and then assigning an operation and expression. 

Tip: You can leave the else statement empty if you do not have a different action you want to create for a different decision. 

Condition Example:

If we were to play a racing game, we would need to assign a condition on how we determine the winner. 

If car position X is greater than finished line position then set score equal to score + 1. 

Additional Articles:

Did this answer your question?