What is a variable ?
For a little introduction, to the uninitiated, variables are place holders for data, think of algebra. Variables can be numbers, strings/text or even variations of other variables. Here is an example:
level = 1;
strength = level;
damage = strength + 2;
Type of variables
Game Maker offers a variety of variables.
Built in variables, which have preset functionalities.
Example: direction 0; (right)
Local variables, which are local to scripts and can't be used anywhere else.
Example: var spd = 15;
Instance variables, which are initialized in the create event of an object. This variable can be used anywhere in the object and doesn't require a prefix.
Example: timer = 30;
global variables are variables that can be used anywhere in your game maker project. Global variables come in two shapes:
1- global.damage = 5;
2- globalvar damage; damage = 5;