GML is GameMaker’s proprietary, strongly-optimized scripting language. It blends the readability of Python with the curly-brace structure of JavaScript and C#. This comprehensive guide breaks down everything you need to know to master GML, from fundamental syntax to advanced programming techniques. 1. Understanding GML: Visual vs. Code
var inventory = ds_list_create(); ds_list_add(inventory, "Potion", "Sword", "Shield"); var item = ds_list_find_value(inventory, 1); // "Sword" ds_list_delete(inventory, 0); // Remove "Potion"
// Else If if (score >= 100) show_message("You win!"); else if (score > 50) show_message("Almost there!"); else show_message("Keep going."); gamemaker studio 2 gml
Variables automatically created by GameMaker for every object instance (e.g., x , y , speed , direction , sprite_index , image_alpha ).
show_debug_message("Hello, World!");
: Specifically for rendering graphics, including sprites and GUI elements. GameMaker Manual Key Features and Syntax Flexible Functions : You can define custom logic using the
GameMaker is currently transitioning to . The latest betas introduce Rollback Netcode (for fighting games) and improved GX.games export. Keep your GML updated with the latest runtime. show_debug_message("Hello, World
Under the hood, GML compiles to native machine code (via YoYo Compiler 2). You can spawn thousands of objects without frame drops. For 2D platformers, shooters, RPGs, or puzzle games, performance is rarely an issue.
// Play a sound var snd = audio_play_sound(snd_laser, 10, false); // 10 = priority, false = not looping For 2D platformers