Discussion in 'Programming' started by yuna3849, Jan 12, 2017.
I made several rooms.
How can I change starting room(default room)?
The starting room is traditionally whatever room is at the top of your room resource list in the GameMaker window. You can also use functions like room_goto to change what room is played first, if you want it to be dynamic for whatever reason.
This is a most unhelpful answer. I see no place in GMS2 where I can VIEW or CHANGE a room index value nor anywhere in any of the settings choices where to set which room is my startup room in the GMS2 editor. In UNITY of course you tell the program which Scene to start with. The problem comes from renaming rooms or moving rooms around into Groups, etc.., how to tell which is the "default" or "startup" room, how to change it? Right now it appears to be 100% guess work, which sucks.
There isnt one.
Thats neat. This is Game Maker Studio V2
Its not really, its the room in your room list thats at the top because resources are ID indexed, so what ever is at the top is room_0
It's as @Jabbers said. If you want a room to be the starting room, just drag it to the top of the list.
Regardless of groups and whatnot, the very first room in the resource tree is room 0 -- not to be confused with Room0 (or room0 or any variation thereof). Even if it's in a group, if that group is at the top of the resource tree and that room is at the top of the rooms in that group, then it's room 0. Room IDs are assigned at compile time, hence the reason you use room constants (the names of the rooms).
Note: The above statements only apply to Studio. In GM Legacy, IDs are assigned upon creation and importation.
The room_goto() bit was kinda wrong, though. I mean, I get what he was saying, but the way he said it was wrong. At the very beginning of the game when it first loads up, the first room is ALWAYS room 0. But you can use room_goto() of course to specify the starting room for continues and game overs, rather than taking the buggy lackluster game_restart() way. But other than that, room_goto() does nothing for specifying where the first room is. lol
*squints at posting dates for the first two posts and the outburst following them*
Just because I wanted to show my response. Jabbers is right. For Jason C. Jabbers didn't say anything about VIEWING or CHANGING room index values.
You could always make a room at the top of the room resource list, for example 'rm_initialize' and put 'room_goto(desiredRoom)' in the creation code.
Lmao, I login to see this random topic blowing up two years after I posted in it.
The first room in the room list is still the first room played in GMS2.
In the above image, the following behaviour can be expected:
room_goto(game_room); will take the player to the room named game_room.
room_goto_next(); will take the player to game_room if it is called while in the room main_menu, or it will produce an error if called while in game_room (because there are no more rooms to move into as we have reached the end of our room list).
The index of the rooms is 0 for main_menu and 1 for game_room. The engine variable room will return 0 if you are in main_menu and 1 if you are in game_room, but understand it corresponds to the order the rooms are in the list, so if you put game_room first, then game_room adopts index 0 (because it is as the start of the room list, and 0 is the first item for the computer-- not 1).
If you can help it, just refer to rooms by their name.