room

The index of the current room.

Syntax:

room;


Returns: Real


Description

This variable holds the room index for the current room that your game is running. This is not a read only variable, however changing this will not change the index value for the current room, but rather change the room to match the index that you have set the variable to. Care should be taken when doing this as if the index you change the variable to is not valid the game will throw an error and close. In general it is much better practice to use room_goto to change rooms.


Example:

if room_next(room) != -1
   {
   room_goto(room_next);
   }

The above code will check to see if the next room exists and if so, it will go to it.


Back: Rooms
Next: room_speed
© Copyright YoYo Games Ltd. 2018 All Rights Reserved