GameMaker Saving Rooms and Instances

W

Will Roberts

Guest
Developers,

I am trying to wrap my head around a concept that I am not getting. I am trying to create randomly generated rooms that will remain after the character transitions to a new room. I'd like all of the objects to remain too.

I have:
room_start (where the o_player starts and is persistant)
room_dungeon (this room has two objects, the o_camera and the o_level_generator)

When I descend, a new room is created by using

global.new_room = room_duplicate(room_dungeon);

and then

room_goto(global.new_room);

What I am trying to do is; have a static room at the top. Descend an untold amount of times and be able to ascend back up through the rooms that have been previously created.

Right now, I can descend 10 times but when I use the ascend, it takes me back to room_start. I am about to create a variable that is a counter for room_level and concatenate that to the global.new_room variable so that I can store multiple rooms and then I will just use that variable on the room_goto based on the current level.

Any concepts on this topic to help me understand would be greatly appreciated.

Will
 
J

Jordan Robinson

Guest
Could you use a ds_stack to store the ID of each room you create? Then as you move back up through the rooms you would pop each one from the stack so if you moved back down you would get a new random room. Or if you used a ds_list or something then you could keep each randomly generated room so the player could move between those and then only generate a new random room when entering a previously unvisited level
 
Top