Learning GameMaker Studio 2 GML is a journey. Start by replacing Drag-and-Drop with simple Step events. Then, adopt Structs and Functions. Finally, master optimization and Feather annotations.
GML is unique because it grows with you. It can be as simple as x+=5 for a teenager's first game, or as complex as a multi-threaded 2.5D renderer for a Steam hit (like Undertale or Hyper Light Drifter).
Your next step: Open GameMaker, create an Object, open the Create Event, and type:
show_debug_message("Hello, GML World!");
Run the game. You are now a GameMaker developer. gamemaker studio 2 gml
Have a specific GML problem? Drop a comment below or check the official YoYo Games manual—it is surprisingly excellent.
If you are migrating from Drag-and-Drop, here is the bare minimum you need to write code.
GameMaker is currently transitioning to GameMaker (LTS vs Beta) . The latest betas introduce Rollback Netcode (for fighting games) and improved GX.games export. Keep your GML updated with the latest runtime. Learning GameMaker Studio 2 GML is a journey
GML now supports proper functions and constructors.
You can also use the Collision event (e.g., Collision with obj_lava):
hp -= 10;
x = checkpoint_x;
y = checkpoint_y;
GMS2 has simple, powerful movement functions. Run the game
The 2.3 update modernized GML significantly. Gone are the clunky legacy functions (ds_list_add). We now have real arrays and structs.
This is GML’s superpower. with allows you to switch the scope to another object temporarily.
// Make every enemy in the room explode with (obj_enemy) instance_destroy(); effect_create_above(ef_explosion, x, y);
// Make all enemies run toward the player with (obj_enemy) move_towards_point(obj_player.x, obj_player.y, 2);
Pro Tip: Never use obj_enemy.x to get a single value if there are multiple enemies (which one?). Use with or instance_nearest() instead.