Global variable (Game Maker)

( Game Maker 6.1, 7 )

A global variable is a variable that can be used by any object in the game.

Global Variable Names

Global variables follow the same rules for naming as other variables, except for one major difference. They are prefixed with global. Here's some examples :

global.health
global.money

Creating Global Variables

You can create a global variable the same way you create any other variable in Game Maker, by giving it a value:

global.health = 10;
global.money = 2000;

Built-in Global Variables

Built-in global variables do not need to be prefixed with global.

Related Pages

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution 2.5 License.