• Create Simple Game Menu Using Gamemaker Tutorial
Create Simple Game Menu Using Gamemaker Tutorial

Create Simple Game Menu Using Gamemaker Tutorial. The menu will have three topic items PLAY, CREDIT, EXIT. In here, we are making it simple, when we click on the PLAY button, the game will go to the Play Room. If we click on CREDIT button, it will go to the CREDIT Room and if we click on the EXIT button, the game will be stopped and we will exit the application.

To do this, we need 3 buttons, it means the game will have three objects obj_play_btn, obj_credit_btn, obj_exit_btn. Each object has its own sprites (image skins), so we need 3 sprites which are spr_play_btn, spr_credit_btn, spr_exit_btn.

Note: here we have to think about when we want to click on the button, we move the mouse over the button, the button should be changed and it should have some effects. So, it means the sprite button will have two images, 1 for default button and 1 for mouse over status.

Sprite Game Maker Hover Button Simple Menu Tutorials  

Step 1: Create 3 sprites spr_play_btn, spr_credit_btn, spr_exit_btn

Step 2: Create 3 objects obj_play_btn, obj_credit_btn, obj_exit_btn and pick correct sprites for them

Step 3: Create 3 rooms, 1 - Room_Menu ( Welcome Room), 2 - Room_Play, 3 - Room_Credit

Step 4: Now, we will program for obj_play_btn. When users click on this button, the game will go to the Room_Play

This obj_play_btn object has four Events: Create, Left Released, Mouse Enter, and Mouse Leave

Sprite Game Maker Hover Button Simple Menu All Mouse Events Tutorials  

On the Create Event of obj_play_btn object, we will add Change Sprite Action of Main 2 Tab. We will set image index (subimage) of this sprite = 0 and image speed = 0 applied for spr_play_btn. The image index changed only when the mouse over/ mouse out. When the mouse over, we will set image index = 1 and for the mouse leave, image index = 0.

Sprite Button Simple Menu, mouse over, mouse leave Game Maker Tutorials  

On Mouse Enter Event, add Change Sprite Action and set image_index (subimage) to 1, speed still be = 0 . So, it means when the mouse over, our play button will change color because image 1 of spr_play_btn has different colors with image 0.

Sprite Button Simple Menu, mouse enter event, mouse leave Game Maker Tutorials  

On Mouse Leave Event, add Change Sprite Action and set image_index (subimage) to 0, speed still be = 0 . So, it means when the mouse over, our play button will change color back to the default state.

On Mouse Released Event, add Different Room Action and select Room Play. It means when user clicks on the Play button, it will go to the Play Room.

Sprite Button Simple Menu, mouse left released event Game Maker Tutorials  

Step 5: Do the same step 4 for obj_credit_btn but instead of spr_play_btn, we replace it with spr_credit_btn and change the room to Room_Credit

Step 6: For the  Exit Button obj_exit_btn Object, we do the same step 4 for create, mouse enter, mouse leave but the Mouse Left Released Event, we just add the End Game Action (You can find this End Game Action on Tab main 2). So when user clicks on this exit button, the game will be ended.

Sprite Button Simple Menu, mouse left released event exit object button Game Maker Tutorials  

Step 7: All objects programmed and prepared. Now we just put them in the Room_Menu and run the game and test it.

The problem is you can go to the Room_Play or Room_Credit but you can not get back to the Room_Menu. So, you should create one more object like a back button (or empty object with ESC key) click on that will go back to Room_Menu.

Also, on the Room_Play Game or Room_Credit you can display the Welcome Text at the center of the game screen to let user know you are going to the correct room. Check the Code game maker tutorial for how to display the text on the center game screen if you don't know how.  

Roberts

Hey! I was wondering how you could make a menu, but instead of using your cursor to go over it, instead use my keyboard?

5/19/2016 9:11:47 AM
John Williams

following step by step, i feel that is so easy to do it well. your words is simple and easy to get. Thank a lot !

5/24/2016 3:57:25 AM
liam 12

i followed your tutorials and did it step by step. And you know, it's really useful and easy to get. With 7 steps, i had created Simple Game Menu Using Gamemaker Tutorial

6/2/2016 4:07:06 AM