A downloadable asset pack for Windows

Buy Now$9.99 USD or more

Room switch - Seamless rooms (found on marketplace and itch.io)

Deactivate and activate areas



Short desc:

Sometimes you want a giant world or room. But you would like to split it up into small pieces and travel between them without notice the room change. Also providing a YYZ that works in GMS2  with "asset layer". So it do NOT work with the "tile layer" in GMS2. So you can NOT use animated tiles at the edge of rooms.


Check the video to get a step by step.


You also need to add the exCamera.gmez that is located in the included files folder and add it as an extension.

(You only need to import the obj_ex_camera)

This extension:

This code module let you travel from one room to the next without notice the room change (ok GM cause a little load room delay):

The view is always in center of the player except on the edges of your big room where the view is limited like an ordinary room.

You can add special objects on the edges that show in all rooms, to hide edges.

If you want to have dynamic stuff near the edges you can set it to zoom in when travel from room to room, this will hide the other room a little.

Add special move coordinates that is recalculated for you.

All in GML and should work on any platform

Lag when travelling from room to room:

GM must load the room you travel to. So if you use alot of objects you will get a small delay. You can mask it by:

  1. Don't use edge objects or tiles near the edge. Just use a tile able background.
  2. Use the zoom feature in scr_room_switch_CREATE(...,TRUE)
  3. Set the player to walk slowly over the edge.  Use if scr_room_switch_IS_ON_EDGE() {make player walk slow} (best result).
  4. Use smaller rooms that GM can load faster.

Code example:

Player object:

You only need to create a 2d array of the rooms you want and call a script in the create event.


and call:


You can also randomize it.


Its important that we use room_duplicate(). Because room switch need that all room ids to be unique. Room_duplicate(rm_1) will create a duplicate of the rm_1 room and give it a new id.

Other examples:


This would just put rm_2 right in rm_1.


This would put rm_2 under rm_1.

Different room sizes:

You can also use different room sizes.

After scr_room_switch_CREATE

Create a 2d array with the room sizes:


After scr_room_switch_CREATE call:


Just make sure that kolumns got same room width and rows got the same room height Ex:

Edge objects:

You can add special objects that show in same place in all rooms

Just set it to persistent and set the parent to "obj_room_switch_on_edge_parent"

Add it in the room where your player object is. You need to put edge objects near the edge of each room so the player can "see" the room before he gets there. If you place a ordinary object near the edge it wont be visible until the player get to the next room.

Edge objects in each room:

You can also add edge objects in each room. This will make it more easy to place the edge objects.

Just place the edge objects in each room and add one object in the first room of your game:


Done :-)

But that means all rooms must be loaded. Room switch must loop through all rooms in the 2d array. And all create events for all objects in those rooms will run. And you may not want that. So to avoid running a objects create event just add this line first in the create event:

if scr_room_switch_IS_LOADING(true) exit;

This will destroy the object when room switch is loading the edges in the room. If you use the destroy event for something just add this as the first line:

if scr_room_switch_IS_LOADING() exit;

And if the object got a room start event you dont want to run you must add:

if scr_room_switch_IS_LOADING() exit;

Moveable edge objects:

If you use a move to click position object you only need to add x,y array variables. Call init script and add a script before you move.

Create event:

Step event:
// Ex Move script
if x>ClickedX[0] x-=5;
if x<ClickedX[0] x+=5;


You can also use tileset on the edges. Just add the tileset as you usually do and add one object in the first room:


You can change how much tileset that is cloned to the other rooms. Go to the objects create event and change:


Right now 800 pixels from the edge is shown in the other rooms. If you see tiles disappear when you travel from room to room just increase the value.

Artefact lines

When working with tiles you may see artefact lines on the edges of the tiles. The room switch code will automatically set interpolation to false and change the camera to floor the move position. This will make the camera movement and screen look less smooth but it will fix the problem with the artefacts lines. You can change this in object:

obj_room_switch_create_camera > Create event > AutoFixArtefactLines=true;

Auto deactivate:

When the player walk, the edge objects that is far away is automatically deactivated to save cpu. You can change this or add your own objects in the script:


Area deactivate/activate:

You can also add area deactivaters/activaters. This is perfect for dungeons. When the player is inside an area all inside it is active. But step out and all will be deactivated. So you can deactivate monster spawner while the player is not present in the room.

Create your own deactivater by createing a new object and give it a sprite then call:

scr_room_switch_ACTIVATE_UNDER_INSTANCE() while player is inside/collide with object. And call:

scr_room_switch_DEACTIVATE_UNDER_INSTANCE() while playes is outside/not colliding the object.


You can also teleport to another room with just one script:

scr_room_switch_TELEPORT(room, x, y)

Go back to menu/exit game:

If you want to exit the game and go back to the menu just call:


This will unload all edges and the player object for you. Room switch will not destroy any of the rooms created with room_duplicate() if you use room switch for a endless runner.

Multiplayer offset calc: When you try use room switch for multiplayer you can now get the offset values from other players with the code:

scr_room_switch_MULTIPLAYER_OFFSET_CALC(your room, other players room);

Then use the return array to recalc the other players pos ex:

var offset=scr_room_switch_MULTIPLAYER_OFFSET_CALC(your room, client.room); client.x=network_x_value+offset[0];

Endless runner: OBS: There is a bug in room_duplicate that prevents persistent objects (edge objects is persistent) from creating in duplicated rooms. I have send YoYo a bug report about this. You can workaround the problem and use tiles instead of edge objects. You can then place ordinary objects under the tiles.

You can also create a "endless" runner. This is how you ordinary setup room switch:


This will create a 2x1 room.

But we can use rm_y0_x0 and rm_y0_x1 as templates to setup a endless runner. Simply duplicate the rooms with room_duplicate().

Let setup a 2x2 room with our 2 rooms:

MyBigRoom[0,0]=rm_y0_x0;   MyBigRoom[0,1]=room_duplicate(rm_y0_x0);
MyBigRoom[1,0]=rm_y1_x0;   MyBigRoom[1,1]=room_duplicate(rm_y1_x0);

But you may want a 1x50 room so you can use a for loop:

for (var i=0; i<50; i+=1)


Buy Now$9.99 USD or more

In order to download this asset pack you must purchase it at or above the minimum price of $9.99 USD. You will get access to the following files:

RoomSwitch.gmez 452 kB
RoomSwitch_2_3_4.gmez 453 kB
RoomSwitch_2_3_5.gmez 693 kB
RoomSwitch_2_3_6.gmez 693 kB
RoomSwitch_2_3_6.yyz 1 MB

Download demo

Room Switch Demo.exe 2 MB

Development log