O'Reilly logo

GameMaker Game Programming with GML by Matthew DeLucas

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Understanding parts of GML scripts

GML scripts are made up of many different parts. The following section will go over these different parts and their syntax, formatting, and usage.

Programs

A program is a set of instructions that are followed in a specific order. One way to think of it is that every script written in GML is essentially a program. Programs in GML are usually enclosed within braces, { }, as shown in the following example:

{
    // Defines an instanced string variable.
   	str_text = "Hello Word";

    // Every frame, 10 units are added to x, a built-in variable.
    x += 10;

   	// If x is greater than 200 units, the string changes.
    if (x > 200)
    {
    str_text = "Hello Mars";
    }
}

The previous code example contains two assignment expressions followed by a ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required