Rooms are where your game takes place. This is where you place your instances for the game.
Splash Screen – Showing your logo and setting game variables
Menu – A selection screen where player can set difficulty and play a level
Shop – A place where a player can spend coins they have collected
Game Levels – Where the action happens – there may be many of these
Boss Levels – A special (usually hard) level between stages
Game Over – Shows the player’s final score
Room backgrounds can be simple, or animated, such as using a parallax effect to create depth. A parallax effect is when different background layers move at different speeds, creating an illusion of depth within your game.
You place your instances in the room, where they run and react to each other, or for example to the player’s input.
Room Editor
GameMaker has a powerful room editor, allowing you to set and customize it as required.
Set code that executes when the room starts.
Set a background color, or sprite(s) as the background.
Add tiles for complex backgrounds, allow you to “paint” your level by placing individual tiles.
Set up views (when you only want to show part of the room at a time).
Name the room and set the dimensions.
For naming purposes, you should use a prefix bg_ which allows you to quickly know what the asset will be used for.
You can also make the background move, for example, to the left, great if you are doing a space-shooter type game.
restarts the room you are currently in.
Basic Projects
- A)
Set up a splash screen that plays a sound and then goes to the menu room after five seconds.
- B)
Create a menu that has three clickable objects. Clicking each one takes you to a different room.
Advance Project
- C)
Create two rooms, A B. Visualize them as:
A B
Useful Functions
Both of the preceding variables return the height/width of the current room. These variables can then be used, for example, to draw a border or place instances to prevent the player from leaving the room when tied with some collision code.
Summary
You should now understand how to create and set up rooms. You understand which room will run first. You know how to traverse between rooms and set up a basic background.