Tutorial 4: Creating a Game Room in GameMaker Studio 2
Change the Room size
In the Assets Browser menu, double click the room that you want to add a background to. The default room is Room1
If you don’t see the Layers panel for the room appear on the left side of GameMaker, go to the top menu, click Room – Layer View & Room Properties.
For our simple game, we want to change the room size to be 960 pixels wide by 640 pixels high.
This is in the Properties section of the Room Editor panel.
Change the Width to 960 and the Height to 640.
Setup the room background
In order to have a background image for you room, you’ll need two background layers, one for the rooms background colour and another for the rooms background image. Ensure that you setup the background layers like this. If you just try to create a room with a background image only, it will cause problems in your game later when you add movement to background image.
- Rename default Background to BackgroundColour
- Click on the black bar beside Colour
- In the Hex box type 5e3f6b this will give you a purple colour
- Create a new Sprite in the Assets Browser. Name it bgRoom1 and import this transparent stars background file.
It can also be found inside the zipped resources for this game spaceshooter-assets/backgrounds folder - From the Assets Browser, double click back into the room in the room editor find the icon to Create a New Background Layer
- In this new background layers properties, click on No Sprite and choose the sprite you just created in Sprites for the background.
- Under the Colour option in the background layer properties check two boxes, Horizontal Tile and Vertical Tile. This will create a star effect background.
- Scroll down into this new background layers properties you can make the background animate. If you are developing a top-down shooter, enter 0.5 into Vertical Speed