In the script editor, at the bottom there are a few buttons. There is actors, variables and functions, and variables. Choose variables, then add. Then fill out the fields:
Name: what you want the variable to be called- var, enemyWalk, etc.
Integer/Real/String: the type of number: integers are whole numbers including negatives: -3, -1, 0, 2, 3060 etc.
Real numbers include decimals: 1.5, -6.7896538, 2.001 etc.
Strings are lines of characters, such as text: Hello_?, Password etc.
Global/Actor: a global variable is one that applies to the whole game, and each actor can acces it directly.
An actor variable is a variable applied to every actor, thus each actor has thier own copy of that variable.
in a particular actor's script editor, it's actor variable can be accesed by the variable name. To access another actor's actor variable,]
you must put actor.variable. examples: x, y, (view.x, player.y) actor1.health etc.
Array: an array is a variable with multiple values, accesed by a number in square brackets []. The array size is the number of
values for the array. For example, an array variable 'var' with array size 4:
- Code: Select all
var[0]=2;
var[1]=0;
var[2]=72;
var[3]=9;
Save group: put a name here if you want to save the variable, and put each variable you want to save in the same save group.
You may want to save things like highscore, for example. If your variable does not need to be saved, don't enter a save group name.