Creating Rooms Through Code

B

BenjaminB

Guest
Hello!

I am having some issues figuring out where to go from here... I currently have a room that consists of block objects that represent future rooms.

I am trying to create rooms via code which doesn't appear to be so difficult:
Code:
var _newRoom = room_add();
room_set_height(_newRoom, 1152);
room_set_width(_newRoom, 1152);
room_set_persistent(_newRoom, true);
This is perfect! Next is to give this room some tiles:

This looks great: room_tile_add

Uh oh, this is deprecated... Apparently not valid for GMS2.0 :(

And try as I might, I can't find a new alternative means to accomplishing what it is I am trying to accomplish. Which is to be able to create a room through code, add objects and backgrounds/tiles to this room accordingly.

Does anyone know of any new tricks?

Much appreciated!
 
B

BenjaminB

Guest
Trust me I looked long and hard, but it kept coming up with things I didn't feel were associated with the coding aspect. Or maybe my implementation of them.

Than Youtube was showing some things, but it was pre-determined. Mind needs to be more RNG. I know the logic (Java Programmer). But implementing it in this new system seemed off. Maybe my keywords weren't refined enough.

But I will take a look at these! Thank you!
 
B

BenjaminB

Guest
So I did find this information, but I do have some confusion.

If I have a script that implemented my first lines of code, the var _newRoom = room_add();

How can I use that variable to implement these Tilesets? It would appear as those codes require you to be in the room itself in order to implement (via some sort of script or object even). What I am trying to achieve is not creating a room through an editor, but through a script form the initial room. The editor will only have one room, the components for the game will be in the editor. But the new rooms will be created via code.

I also learned that you cannot use:
with (room) {
set attributes
}

Which was kind of disappointing. Will what you recommended (the layering thing) work outside of the physical room?
 
B

BenjaminB

Guest
Ok, so I just needed to do more digging, was in the right area! Thank you so much Rytan451!
 
Top