room_add

This function creates a new, empty, room and adds it to your game, returning its index to be stored in a variable for all further code that deal with this room.

Each room added in this way is permanently added to the game until the executable is closed, i.e.: rooms added through code cannot be deleted again. This has important implications for memory use and so you should use this function with care.

NOTE New rooms are not part of usual room ordering, so they do not have a "previous" or "next" room (meaning that the functions room_next and room_previous will not work). To jump from the added room to another, you must use the index of the room itself.

 

Syntax:

room_add();

 

Returns:

Room Asset

 

Example:

global.myroom = room_add();
room_set_width(global.myroom, 1280);
room_set_height(global.myroom, 720);
room_set_persistent(global.myroom, false);

This will create a new room and store it in the variable global.myroom. It will then set its width to 1280 pixels, its height to 720 pixels, and its persistence to false.