Gamemaker Studio 2 Gml May 2026

GML is GameMaker’s native scripting language designed specifically for 2D game development. It mixes C-like syntax with engine-specific functions and built-in variables, allowing rapid iteration on gameplay, physics, UI, and more. GML is lightweight but expressive, making it well suited for prototypes and full commercial projects alike.

GMS2 has simple, powerful movement functions.

The syntax feels familiar to anyone who has used Java or C#. gamemaker studio 2 gml

// If statement
if (keyboard_check(vk_space) && jumps > 0) 
    vspeed = -10;
    jumps--;

// Switch statement (Great for state machines) switch (state) case "idle": sprite_index = spr_idle; break; case "run": sprite_index = spr_run; break;

// For loop for (var i = 0; i < 10; i++) show_debug_message("Iteration: " + string(i)); // For loop for (var i = 0;


// BAD: O(n^2) complexity
with (obj_enemy) 
    with (obj_bullet) 
        // collision check

// GOOD: Use collision functions or instance_place lists var collisions = instance_place_list(x, y, obj_bullet, false); // BAD: O(n^2) complexity with (obj_enemy) with (obj_bullet)

Recently, GameMaker introduced Feather, an intelligent code checker. To use it effectively, you should add JSDoc annotations. This helps autocomplete and catches bugs.

/// @function calculate_damage(attacker, defender)
/// @param Struct.Player attacker
/// @param Struct.Enemy defender
/// @returns Real
function calculate_damage(attacker, defender) 
    return attacker.dmg - defender.def;

Now, when you type calculate_damage(, the editor tells you exactly what parameters to use.

Writing code that works is easy. Writing code that works six months from now is hard.