Set Tile Data In Cell


Description

With this action you can set the tiledata for a tile cell on a tilemap layer. The tiledata is simply a value that reflects the index of the tile along with the flip, mirror, and rotate values, as well as any custom tile masks that you have used. With this action you first supply the layer to target using the name of the layer (a string) as defined in the room editor, and then the column and row on the tilemap layer to set the tiledata for. The "cell" is the area on the tilemap grid that holds the tile you want to set the data for, so if your tiles are 16x16, for example, and the room is 1024x768 the tilemap will have 64 columns and 48 rows.

NOTE: The layer selected must have been defined as a Tilemap Layer in the room editor, otherwise you may get errors.


The final argument for the action is the tiledata itself. You would normally retrieve the tiledata for the tilemap cell using the action Get Tile Data In Cell and then manipulate it using the action Set Tile Data Transform before setting it again with this action. For more information on tiledata, please see the GML section on Tilemaps - Tile Functions.


Action Syntax:

Set Tile Data In Cell Syntax


Arguments:

Argument Description
Layer The layer with the tilemap to target
Columns The cell column position along the horizontal axis to set the tiledata for
Row The cell row position along the vertical axis to set the tiledata
Data The tiledata to use for setting the cell


Example:

Set Tile Data In Cell Example
The above action block code loops through every tile cell in the room, retrieves the tiledata for the cell, flips it, then sets the cell again.