Designing Games with GameMaker
GML Language overview
GameMaker contains a built-in programming language. This programming language gives you much more flexibility and control than the standard actions. This language we will refer to as GML (the GameMaker Language). There are a number of different places where you can type programs in this language. First of all, when you define scripts. A script is a program in GML. Secondly, when you add a code action to an event. In a code action you again have to provide a program in GML. Thirdly, in the room creation code. And finally, wherever you need to specify a value in an action, you can also use an expression in GML. An expression, as we will see below is not a complete program, but a piece of code resulting in a value.In this chapter we will describe the basic structure of programs in GML. When you want to use programs in GML, there are a couple of things you have to be careful about. First of all, for all your resources (sprites, objects, sounds, etc.) you must use names that start with a letter and only consist of letters, digits and the underscore '_' symbol. Otherwise you cannot refer to them from within the program. Make sure all resources have different names. Also be careful not to name resources self, other, global, or all because these have special meaning in the language. Also you should not use any of the keywords, indicated below.
Information on the GML language can be found in the following pages:
A Program
Variables
Assignments
Expressions
Extra Variables
Addressing Variables in Other Instances
Arrays
If Statement
Repeat Statement
While Statement
Do Statement
For Statement
Switch Statement
Break Statement
Continue Statement
Exit Statement
Functions
Scripts
With Construction
Comment
Functions and Variables in GML
Alternative versions
You can also read this manual on one single long page (± 1.5 mb)
Also available in:
Download helpfile
Also available in:
Download helpfile