General Layer Functions

The GameMaker Room Editor permits you to add layers of different assets to your room. These can be tile maps (using tile sets), backgrounds, sprites or sequences, particle systems and instances, but note that unlike the room editor, you are not limited to a single asset type per layer, and can add multiple asset types to the same layer - for example you can have a background and a tile map all on the same layer.

NOTE Each asset that is added to a layer is considered an element of that layer.

This section outlines the general functions used when working with room layers, as well as a few functions specific to working with instance layer elements:

 

We also have a couple of extra functions relating to targeting layers in a different room. It may be that you want to change something in a room that is not the current room, or maybe you want to generate rooms procedurally, or any number of things. To enable this we use the following functions:

 

What you do here is set the target room using the appropriate function and then call the layer functions are normal. These layer functions will now apply only to the target room and not the current one. When you are finished you'd call the reset function to return the code scope back to the current room again.

WARNING While targeting another room, you can use all the regular layer functions except you cannot create instances using instance_create_layer() or instance_create_depth(), nor will the layer function layer_add_instance() be available.

Finally, and this is exclusively for use with instances on layers (although the layer itself can have other elements, they will not be affected by the following functions), you have a couple of functions that can be used to deactivate or reactivate all instances: