Tutorial 12. Creating a Start Room for your game
There is a start button in the Asset Resources folder you can use.
But I’d prefer if you created your own! You get marks for originality. You could use https://www.piskelapp.com/ for this.
Create a start button
- Create a sprite for your button – call it sprStartButton
- Import a button graphic for this and align it to Middle Centre
- Next, create a button object – call it objStartButton and associate the sprite above with it
- On objButton add the following events and code:
Mouse Enter event:
//only useful if your button sprite gif has 2 frames //changes the sprite to the 2nd frame image_index = 1;
Mouse Leave event:
image_index = 0;
Mouse Left Pressed event:
room_goto(room0); //or whatever your first room is called
Create a Start Room
- Duplicate your first room
- Rename it to startRoom
- Set your startRoom to the home room for your game. You can do this by clicking the organise icon beside your room and drag the startRoom above Room1
- Go into the start room and delete any unnecessary objects from the Instances layer – such as the player object, the enemy spawner etc.
- Place the button object you created above into the room
- Run your game to test if the start button works
How to Add instructions to your Start Room
- Use https://pixelspeechbubble.com/ or https://pixlr.com/x/ to create a set of instructions for you game.
- I recommend creating a 500 x 400 for the size of the instructions, with a transparent background.
- Then save the image as a PNG and import it as a sprite into GameMaker and make an object out of it to place into your start room.
Add text to the screen
Example if you want to add a copyright notice into the game
- Create a Draw-Draw Event on your objStartButton
draw_self(); draw_set_halign(fa_center); draw_set_valign(fa_middle); draw_text(x,y+100,"Copyright 2021 T.Brides");