GameMaker:Variable Management

From GMG Manual

Jump to: navigation, search

Variables in GameMaker are created when first used by the game code; there is no need to define the variables ahead of time. Variables are limited to containing any number between -32767 and 32767. A variable can be set to a number using code like the following example:

gold = 10

It is also possible to add, subtract, multiply, or divide the value of a variable, such as:

gold = gold + 10
gold = gold - 10
exp = gold * 2

Complex math isn't supported. This limitation can be worked around by putting seperate operations on new lines of code.