M
mdbussen
Guest
I am trying to instantiate a new room via GML and then enter the new room. This appears to work (in the sense that I can see my code is moving past the 'room_goto' function call) but I never see the display change to reflect the fact that I am in a new room. Here is my code:
I have some buttons on my "current" room (the one i am in before the "room_goto" call) that never disappear even though the code moves well past this "room_goto" call. I also never see anything related to the 'obj_world_creation_tracker' object, which has several things defined in its draw event that I should be seeing on the screen.
The GMS2 documentation has the following text pertaining to the "room_goto" function:
Code:
// create a new room and set up the width/height and background color
var room_handle = room_add();
room_set_width(room_handle, DISPLAY_WIDTH_PIXELS);
room_set_height(room_handle, DISPLAY_HEIGHT_PIXELS);
room_set_background_color(room_handle, c_blue, true);
room_set_viewport(room_handle, 0, true, 0, 0, DISPLAY_WIDTH_PIXELS * 2, DISPLAY_HEIGHT_PIXELS * 2);
// jump to the new room
room_goto(room_handle);
// instantiate a 'world_creation' object to keep the user updated on what is happening during world creation
var object_handle = instance_create_depth(0, 0, 0, obj_world_creation_tracker);
ds_map_add(global.object_map, obj_world_creation_tracker, object_handle);
The GMS2 documentation has the following text pertaining to the "room_goto" function:
I am not quite sure what to make of this. does this mean that the code I have right after 'room_goto' is not guaranteed to be called in the new room? Is this comment related to the problems I am having or not?Note that calling this function does not instantly change rooms, and the room will not change until the end of the current game frame (meaning that any code after this function will still be run, as will some events).