Rooms

Rooms in Game Maker

Room Guide

The room in Game Maker is the basic spatial unit of your game world. Rooms can be made into levels, floors of castles, or whatever that requires space for your game objects to live in.

Change Rooms

The current room can be changed using room functions and room actions.

Goto The Next Room

Room Events

Room Properties

The properties of a room can be set and changed using the Room Properties window before compile time. During runtime and game play, some of the room properties can be changed using GML.

Name / Index

The room name is also it's index and is contained in the variable room.

Window Title = room_caption

Each room in your game has a separate room title known as the room_caption. The room_caption is displayed at the very top of your game window, where the window title or window caption usually is.

Persistence

Each room in your game is independent of each other. Therefore, when you place instances of an object into a room, those instances will only exist in that room. Setting the variable room_persistent to true will make the room persistent.

Size

The default room size is 640x480. The current height and width of a room are contained in the variables room_height and room_width. This can be changed in the Room Properties window before compile time.

Large Rooms

Large rooms with many instances active will slow down Game Maker much. To avoid this, you can deactivate objects that are not in the view.

Speed

Each room runs at it's own speed and the room_speed determines the overall game speed while the room is active (the one currently being used). By default, the room_speed is 30 steps per second. However, we recommend setting it to 60 frames per second for a smoother frame rate.

Room Speed and Animation Speed

The room_speed also affects the speed speed of sprites as the variable used to control the sprite animation speed ( image_speed ) is based on a ratio relationship with the room_speed.

Creation Code

Each room is able to execute GML code when it is created. The code must be placed in the Room Creation Code part of the Settings Tab of the Room Properties Window.

Views

(Main article: view)

If you are using views, the game window will appear only as big as the main view. This allows you to make games that have rooms bigger than the current visible area for scrolling games.

Backgrounds

(Main article: background)

Each room has it's own background. The background as a whole (usually) appears behind your game objects. The entire background as a whole can be composed of a background_color, background images, and / or tiles. Background images are shown "above" the background color. Tiles are drawn over both the background images and the background color.

Errors