This function permits you to go to any room in your game project, whether created using code or in the resource tree. You supply the unique room ID value (stored in the variable for the room name, or as a variable returned from the function room_add. 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). This function will also trigger the Room End event.
room_goto(index);
参数 描述 index The index of the room to go to.
N/A(无返回值)
switch (global.rm)
{
case 0: room_goto(rm_level1); break;
case 1: room_goto(rm_level2); break;
case 2: room_goto(rm_level3); break;
}
The above code will check a global variable and change room based on the value that it holds.