This function copies one room to another, removing all instances, tiles, etc. from the room that is being copied to and replaces them completely with the new room's contents.
You supply the room to be copied to (either as defined in The Asset Browser or as returned by the function room_add) as well as the index of the source room.
NOTE Calling this function on a room asset created in The Asset Browser will permanently change the contents of the room, and even calling game_restart will not return the room to its original state. Only ending the game and opening it again will start with the room in its original state again.
room_assign(ind, source);
Argument | Type | Description |
---|---|---|
ind | Room Asset | The room to be copied to. |
source | Room Asset | The room to be copied from. |
N/A
global.rm = room_add();
room_assign(global.rm, rm_base);
The above code will add a new room to the game and then copy the contents of the room indexed as rm_base into it.