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

Aligning the pieces of the puzzle game to a grid

Now that the necessary resources have been created, scripts can be written to lay out the initial pieces of this puzzle game. The first script will be the Create event of obj_grid_manager. This script will define several variables within obj_grid_manager. It will also execute scr_create_in_grid to populate its pair of two-dimensional arrays.

The Create event of obj_grid_manager

The Create event of obj_grid_manager will create the grid in which the objects are placed. The first portion of the code, shown as follows, will define several instanced variables that will be referenced throughout the game:

// Defines the number of columns in the grid. columns = 10; // Defines the number of rows in the grid. ...

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