What is a state and how do you use it?

In Alice’s Adventure, a state is essentially a boolean, or a switch which can be flipped to be either ‘ON’ or ‘OFF’
here the state is at ‘OFF’ position
and here the state is at ‘ON’ position

It is easy to switch between ON and OFF position at any time while making your game. All your states are under the State tab in the right side of your screen, where you know which one’s are at ON and which one’s are at OFF.

Now these states can be used as a condition. For example, if you had a ‘fridge’ which you clicked on to show an object ‘milk’, it will occur freely.

Now if you wanted it to work in such a way that milk is shown only when your state has been turned to ON, then you could do this:

So as you can see here, “My State” is OFF right now. So if you run the game and click on the fridge, it will check if “My State” is ON right now. Since it is not, the reaction won’t work and you won’t get the milk.

Let’s find a way to switch ON the “My State” while in the game.

Now here, if you notice the second interaction box, you will see that if you click on the door, you can set the state “My State” to ON.

This essentially means that while in the game, Only if you click on the door first will you be allowed to take milk from the fridge. Conditions like this can be achieved by using states. Talk to your teacher to find more about states and how well you can use it.