ds_grid_height

Finds the height of a grid.

Syntax:

GML Code Example

ds_grid_height(index);


Argument Description
index This index of the grid to find the height of.


Returns: Real


Description

This function will return the height of the given grid. This value is the number of cells the grid has along the y-axis and is always an integer, as shown in the image below:


Example:

GML Code Example

var i, j;
 for (i = 0; i < ds_grid_width(grid); i += 1)
    {
    for (j = 0; j < ds_grid_height(grid); j += 1)
       {
       if ds_grid_get(grid, i, j) = 1
          {
          instance_create(i * 32, j * 32, obj_Wall);
          }
       }
    }
 

The above code will loop through the ds_grid indexed in the variable "grid" and if the value found in any specific cell is equal to 1, it will then create an instance of "obj_Wall" at the appropriate position within the room.


Back: DS Grids



No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here