GameMaker: Studio and Transitioning to the Next Room

By Michael Rohde

GameMaker: Studio allows you to create rooms that can function as levels of your game. When you create a Room to work with Views, you should do some planning ahead of time.

For example, you can have several Rooms in each game, and each Room can represent a level of your game. Now, assume that you have at least two Rooms created. If you have two Rooms ready to go, you’re ready to create a transition between Rooms.

You can set up a message to display End Room when the player reached the end of the Room. Or, you can update those Actions to transition to the next Room after the player clicks the message box to move on to the next Room.

To transition the player to the next Room, follow these steps:

  1. Open the properties for your controller Object (or create a new Object by choosing Resource→Create Object).

    The Object Properties window appears.

  2. In the Name field, type a name for your Object — for example, controller_object.

  3. Choose Add Event→Step→Step (or select the Step Event if it already exists).

    A Step Event appears in the Events section.

  4. Drag and drop the Start Block Action from the Control tab to the Actions section so that it’s above the Display Message Action (if you have one).

    The Start of a Block Action appears in the Actions section. There is nothing for you to configure here.

  5. Drag and drop the Next Room Action from the Main1 tab to the Actions section.

    The Go to Next Room Action appears in the Actions section. There is nothing for you to configure here.

  6. Drag and drop the End Block Action from the Control tab to the Actions section.

    The Go to Next Room Action appears in the Actions section. There is nothing for you to configure here.

You just set up a Step Event, with a series of Actions that will trigger when the Y coordinate of the player’s plane reaches the end of the Room. The Step Event should look like this figure.

A Step Event with a code block for transitioning to the next Room.
A Step Event with a code block for transitioning to the next Room.

If you want to keep the Display a Message Action to indicate to the player that she reached the end of the Room, you can click and drag that Action, from within the Actions section, into the code block.

You now have a game with two different levels that the player can advance through as she completes a Room. The player’s score carries over to the next Room because score is a global variable and will be relative no matter which Room the player is in.