room_goto


Description

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.


Syntax:

room_goto(index);


Arguments:

Argument Description
index The index of the room to go to.


Returns:

N/A


Example:

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.


Back: General Room Functions And Variables
Next: room_goto_next
© Copyright YoYo Games Ltd. 2018 All Rights Reserved