General Layer Functions

The GameMaker Studio 2 Room Editor permits you to add layers of different assets to your room. These can be tilemaps (using tilesets), backgrounds, sprites or 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 tilemap all on the same layer. This section outlines the functions used when working with instance layers as well as a few general functions for using across all layers:

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:


Back: Rooms
Next: Tilemap Layer Functions
© Copyright YoYo Games Ltd. 2018 All Rights Reserved