A Boolean variable can have have one of two values, true or false, and in Speedernet Sphere it is no different. This variable comes in handy while checking requirement to trigger any reaction.
In the following example, the user has to find the key to open the exit and go to the next scene.
You can watch the example here.
Please note that you can find every element in the Sphere online library.
When all your elements are in place, you can follow the next steps:
- Add a Boolean variable
Step 1 : Add a Boolean variable
On the right column, click on the variable icon.
Then create a variable by clicking on the dedicated function.
We advise renaming your variables as you create them, so you can find them easily in the scenario mode. In our scenario, the variable is called “key obtain” and its default value is “false”.
Step 2 : Define triggers associated to the value
- You need to place the element link to the variable in the scene.
- In our example, the key needs to be visible by default.
- On click, the key changes state and becomes hidden.
- The variable will change by clicking on the key from false to true. (see below)
Step 3 : Create the interaction for the variable’s change
When the variable state turns to true, the door has to become available. The door area needs to be clickable and redirect to the final scene. (see below)
This tutorial sheds light on how to use a Boolean variable through an example. Booleans can also be used for other purposes such as:
- Turn element visible
- Allow access
- Create combination with more than one Boolean
- Visit an area within the scene
- Answer a survey
How are you using Booleans in your project? Share your experience with us!
See you next time in the next tutorial.
You can also check our other related tutorials: