Tile Map Layers

The GameMaker Studio 2 Room Editor permits you to add tiles into any given room using layers. As the name implies, a tile map layer is simply a collection of tile set tiles that are all considered to be at the same depth within the room, and by stacking layers you can make some things draw over or under others. You can also control certain aspects of layers from code, adding or removing things, or changing certain properties of the layer or what it contains at run time. Note that in the room editor you are limited to one tile map per layer (the Tile Layer), but when working with them in code, you can have multiple tile maps assigned to a single layer, with each map having its own unique ID and properties, so:

Below is a list of all the functions that can be used for editing tile map layers:

 

 

Apart from the functions listed above to set tile maps, you also have a number of functions that can be used to manipulate the data of individual tiles. A "blob" of tile data is made up of the tile index plus a few extra bits to show whether the tile has been rotated, flipped or mirrored. You also have the possibility of adding your own bit-mask to the tile data, although this is for advanced users only as you will be masking off bits that are reserved for the tile index - essentially there are 19 bits reserved for your tile indices, but if you only use 8 of them, then you have eleven bits left over that can be used to create a custom mask. This mask can then be used and checked in code to create custom tile collisions or whatever. However, you would normally not need to create your own tile data blobs, and would instead use the function tilemap_get() to get the tile data, then you would manipulate it using the functions below, and then you would set it again using tilemap_set().

Below is a list of all the functions that can be used for editing individual tiles: