Variables in Construct 2
Like most things in Construct 2, variables are really simple. Even though adding variables is fairly straightforward in other languages, Construct 2 makes it easy.
Adding a variable
Adding variables in games is really important. Without variables, you cannot store any data. This will make the game almost nonfunctional, and it limits you to small games.
To add a variable, go to your event sheet and right-click on it. This should bring up a cascading menu. Clicking on the Add event icon will let you add a variable:
There are two types of variables in Construct 2: global and local variables. Variables can be seen in different places. Global variables will be seen throughout the entire game. Local variables you want only to be seen by a game object or a function.
Creating a global variable
Right-click on the event sheet and you can add a global variable. Go ahead and click on Add global variable.
As you can see in the preceding screenshot, there are four fields. You can name...