Creating a variable:
1. Go to the script editor.
2. Click the button [Variables]
3. Click [Add].
4. Type in the variable name, in this case gameState.
5. (Notice that is is integer) click [Add]
6. Click [Close]
After that the code will work. Here are some simple things you can do to manipulate variables.
- Code: Select all
variable=5; // sets the variable equal to 5
variable+=5; // increases the variable by 5
variable-=5; // decrease variable by 5
variable*=5; // multiplies variable by 5
Lastly, the most important thing with variable is that you can use them to make events do different things.
- Code: Select all
if(gameState==0)
{
PauseGameOn();
gameState=1;
}
else
{
PauseGameOff();
gameState=0;
}
The above code will do essentially the same thing that the original code I sent you does. The if statement checks if the variable gameState is equal to zero, and if so execute the code within the {}. If not (else), execute the code after the else. If you want I'll pm you a better description of variables.