Game Maker Programming/Creating a room

< Game Maker Programming

A room is created simply by clicking on a create room button - this is the first step that you must do when creating a game.

The creation of the room will add an entry to the list of resources - the default name of your first room is "room0", with the number incrementing it for each step. To avoid confusion, it is recommended to rename the room as soon as possible - either giving an English-readable name or with your own naming convention.

On the left hand-side of the room design window, you have a set of 5 tabs available.

Settings

The settings of the room contain the basic information about the room. You can set the name, window title (or caption), the width, height, speed (in steps per second), and it's persistence flag.

Backgrounds

By default, the background color of a room is a single gray color. While you can modify it directly, you may want to use a picture as part of a background.

If you have a transparent or semi-transparent background, you can choose up to eight background slots - ones lower down the list are drawn in-front of higher ones.

You can also tag a certain background layer as a "foreground", which causes it to be rendered after the rest of the scene is created. This can be used to create HUDs or other possible decorations.

Tiles

For advanced control over a room's display, you can open the tiles tab. While they use the background resource set, they can appear between objects. Tiles are slightly faster than using objects for display purposes, since they do not require collision checking.

Tiles are located on layers which have a given depth value. The highest depths are rendered first, and lower depths are drawn on-top of existing layers. They normally use images from the Backgrounds image set.

Objects

You can place an object in the room by selecting an object from the list of available objects, and clicking within the room. A left-click will create an object, while a right-click will delete it; you can also use the Shift, Ctrl, and Alt modifier keys to change what you want to do with an object.

Views

A view allows you to control the camera on screen - to enable it, you first need to check Enable the use of Views at the top of the tab. If Enable the use of Views does not appear, you are likely not in advanced mode. Note that if this is checked, you need to ensure that at least one view is visible when the room starts or is otherwise made visible in-game.

In each of the seven views available, you can modify three different sets of options:

Changing rooms

To change a room, you need to create an object and assign an event to an object; you can create events by opening the object's properties. When it's created, find the room change actions (available by going through the tabs on the far right) and add one of the change room actions.

Persistent rooms

By default, rooms will reset once they are left; platforms return to their original position, items will reappear, etc. A persistent room will remain in the exact way as it was left, and will only reset if the game restarts. If you need to reset a persistent room, it may be done manually via scripting.

Persistent objects will not remain with the previous room; they will be transferred to the new room.

This article is issued from Wikibooks. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.