Jump to content


Photo
- - - - -

Creating A Menu In Game Maker


  • Please log in to reply
19 replies to this topic

#1 ThatSnail

ThatSnail

    That Guy

  • GMC Member
  • 1035 posts
  • Version:GM8

Posted 11 May 2008 - 10:04 PM

  • Title: Menu Tutorial
  • Description: Explains how to create a main menu with selectable choices in Game Maker without using a separate object for each button.
  • GM Version: 6.1
  • Registered: No
  • File Type: .zip
  • File Size: 307 KB
  • File Link: Host-a Hosting
  • Alternate File Link: UpUrLoad
Additional Info: Contains 2 Word files (.docx and .doc) for documentation, along with 4 .gm6 files.

The most obvious way to create a main menu is to create an object for each button in the menu. However, this can disorganize the game if you have a lot of buttons, and increase the file size and loading time due to the amount of sprites.

This tutorial explains how to create a main menu using only one sprite and one object for the buttons and still maintain a usable rollover effect. It uses the Instance Creation Code of each instance of the menu button to specify what the button should say and do.

Edited by ThatSnail, 02 August 2011 - 02:56 AM.

  • 3

#2 wirwarenlos

wirwarenlos

    GMC Member

  • New Member
  • 1 posts

Posted 24 July 2008 - 11:22 PM

i dont´t like it..i just wasted my time...

you have to explain how did you draw the text in each buttom.Where says "play,help,exit"??? i can´t do anything in my game man.
but...thanks for doing it to hard. nobody will want to download this..
  • -4

#3 Sanuka-Sama

Sanuka-Sama

    GMC Member

  • New Member
  • 6 posts

Posted 22 October 2008 - 02:52 PM

mmm interesting this is certainly usefull will use it in the beta of my game i think, cuz creating menu's is so much work now. eventhough i make my menu's interactive :) (u can move the character around and get a gun even die XD) anyhow thanks for this interesting tutorial certainly not an waste of time. REALLY REALLY USEFULL :lol:
  • 0

#4 True Valhalla

True Valhalla

    ಠ_ಠ

  • Retired Staff
  • 4880 posts
  • Version:GM:Studio

Posted 22 October 2008 - 09:27 PM

i dont´t like it..i just wasted my time...

you have to explain how did you draw the text in each buttom.Where says "play,help,exit"??? i can´t do anything in my game man.
but...thanks for doing it to hard. nobody will want to download this..


Harsh words <_<

He has 1 post. I suggest you ignore him :)
  • -1

#5 Nadz

Nadz

    GMC Member

  • New Member
  • 42 posts

Posted 23 October 2008 - 04:09 AM

can you put on rapidshare or similar? Those servers are buggy
  • 0

#6 ThatSnail

ThatSnail

    That Guy

  • GMC Member
  • 1035 posts
  • Version:GM8

Posted 24 October 2008 - 02:30 PM

i dont´t like it..i just wasted my time...

you have to explain how did you draw the text in each buttom.Where says "play,help,exit"??? i can´t do anything in my game man.
but...thanks for doing it to hard. nobody will want to download this..

Sorry to hear that.

mmm interesting this is certainly usefull will use it in the beta of my game i think, cuz creating menu's is so much work now. eventhough i make my menu's interactive :D (u can move the character around and get a gun even die XD) anyhow thanks for this interesting tutorial certainly not an waste of time. REALLY REALLY USEFULL :whistle:

Thanks :) And interactive menus are awesome. Good luck.

i dont´t like it..i just wasted my time...

you have to explain how did you draw the text in each buttom.Where says "play,help,exit"??? i can´t do anything in my game man.
but...thanks for doing it to hard. nobody will want to download this..


Harsh words :)

He has 1 post. I suggest you ignore him :)

Lol.
(Ignores).

can you put on rapidshare or similar? Those servers are buggy

I put up a download mirror using WHFF (not rapidshare though; I don't like the limitations of the Free versions of rapidshare). Thanks for the info.
  • 0

#7 MT3Games

MT3Games

    GMC Member

  • New Member
  • 81 posts

Posted 26 October 2008 - 11:56 PM

i dont´t like it..i just wasted my time...

you have to explain how did you draw the text in each buttom.Where says "play,help,exit"??? i can´t do anything in my game man.
but...thanks for doing it to hard. nobody will want to download this..

Sorry to hear that.

mmm interesting this is certainly usefull will use it in the beta of my game i think, cuz creating menu's is so much work now. eventhough i make my menu's interactive :snitch: (u can move the character around and get a gun even die XD) anyhow thanks for this interesting tutorial certainly not an waste of time. REALLY REALLY USEFULL :)

Thanks :whistle: And interactive menus are awesome. Good luck.

i dont´t like it..i just wasted my time...

you have to explain how did you draw the text in each buttom.Where says "play,help,exit"??? i can´t do anything in my game man.
but...thanks for doing it to hard. nobody will want to download this..


Harsh words <_<

He has 1 post. I suggest you ignore him :medieval:

Lol.
(Ignores).

can you put on rapidshare or similar? Those servers are buggy

I put up a download mirror using WHFF (not rapidshare though; I don't like the limitations of the Free versions of rapidshare). Thanks for the info.



This is a BRILLIANT tutorial!, great organization.
  • 0

#8 blackmidget

blackmidget

    GMC Member

  • New Member
  • 15 posts

Posted 20 November 2008 - 01:39 AM

great!! one question though, whats the code? i wanted to use this in a game (if its ok, credit will be given) and i don't know what the code for the menu choice object is. how would i change it if the room name for the first level is different?

Edited by blackmidget, 20 November 2008 - 01:45 AM.

  • 0

#9 ThatSnail

ThatSnail

    That Guy

  • GMC Member
  • 1035 posts
  • Version:GM8

Posted 20 November 2008 - 02:01 AM

great!! one question though, whats the code? i wanted to use this in a game (if its ok, credit will be given) and i don't know what the code for the menu choice object is. how would i change it if the room name for the first level is different?

Thanks, glad you like it :P
No credit necessary; the concepts in this tutorial are pretty basic.

As for the code, it comes in two parts. One handles the Draw event, the other handles the room-changing.
The Draw event one is a bit too long to explain in this post; check "Part Three-- Rollover Text" in the tutorial for that. However, I can explain the room-changing.

Very cheap (but efficient) method used. There's something in each instance that executes its own code that you can specify when it's created, called the Instance Creation Code (go into the room editor, Ctrl+right click an instance, and click Instance Creation Code at the bottom). There, I set some variables, named code and text. Code is a string of text that tells the program what to do when clicked on. It is executed in the Mouse Left Released event, with the code:
execute_string(code);

So each button will do something different when the Mouse Left Released event is activated, based on the Instance Creation Code for that instance. The Instance Creation Codes are things like room_goto(rm_play);, room_goto(rm_play);, etc.

As for the text variable, it just stands for what each button should be labeled as. It's a string, and the text is actually drawn in the Draw Event. Through Instance Creation Codes, you can have one object do different things easily.

Hope this helps :) And for the room name, use room_goto(room name);, replacing "room name" with the name of your room.
  • 0

#10 blackmidget

blackmidget

    GMC Member

  • New Member
  • 15 posts

Posted 20 November 2008 - 02:10 AM

great!! one question though, whats the code? i wanted to use this in a game (if its ok, credit will be given) and i don't know what the code for the menu choice object is. how would i change it if the room name for the first level is different?

Thanks, glad you like it :P
No credit necessary; the concepts in this tutorial are pretty basic.

As for the code, it comes in two parts. One handles the Draw event, the other handles the room-changing.
The Draw event one is a bit too long to explain in this post; check "Part Three-- Rollover Text" in the tutorial for that. However, I can explain the room-changing.

Very cheap (but efficient) method used. There's something in each instance that executes its own code that you can specify when it's created, called the Instance Creation Code (go into the room editor, Ctrl+right click an instance, and click Instance Creation Code at the bottom). There, I set some variables, named code and text. Code is a string of text that tells the program what to do when clicked on. It is executed in the Mouse Left Released event, with the code:
execute_string(code);

So each button will do something different when the Mouse Left Released event is activated, based on the Instance Creation Code for that instance. The Instance Creation Codes are things like room_goto(rm_play);, room_goto(rm_play);, etc.

As for the text variable, it just stands for what each button should be labeled as. It's a string, and the text is actually drawn in the Draw Event. Through Instance Creation Codes, you can have one object do different things easily.

Hope this helps :) And for the room name, use room_goto(room name);, replacing "room name" with the name of your room.




Thanks, just needed to know here the code was.
  • 0

#11 hhkk1712

hhkk1712

    GMC Member

  • New Member
  • 3 posts

Posted 27 November 2010 - 12:32 AM

I try to use another technique for rollover. I create two sprites, and make object of them. Then I use "Mouse enter" event for the object of 1st sprite -> draw sprite action for 2nd sprite. But it doesn't work. I just don't know why. Can somebody help me? Thanks
  • 0

#12 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • Global Moderators
  • 14390 posts
  • Version:GM:Studio

Posted 14 July 2011 - 06:08 PM

Std Msg: Please remove the Local Moderator Said quote (The Tutorial Clean Up Crew).
  • 0

#13 Rysm

Rysm

    GMC Member

  • New Member
  • 17 posts
  • Version:GM8

Posted 16 December 2011 - 04:13 AM

Great tutorial! :D
  • 0

#14 DZiW

DZiW

    GMC Member

  • GMC Member
  • 727 posts

Posted 16 December 2011 - 05:19 AM

Pretty decent. Yet have you ever heard about RTF which ALL Office versions take ok? ;)
  • 0

#15 CrazyGamer

CrazyGamer

    GMC Member

  • GMC Member
  • 81 posts

Posted 27 December 2011 - 01:09 PM

1st: you are still using an object for each button just that it is the same object.
2nd: what are exhibit 1-3 for?
3rd: complicated code. you could get the same result way more easy.
4th: no commented code. for a beginner it would be hard to understand what you did there.comment the code inside the example,that is the tutorial you don't need word tutorials and so on. make it simple, easy to understand and well commented .
  • 0

#16 LLProductions

LLProductions

    LLProductions

  • GMC Member
  • 67 posts
  • Version:GM8

Posted 01 April 2012 - 10:47 AM

This tutorial is very confusing. :wacko:
Where do you put all of the codes?
You're just putting these codes on the tutorial, are they all in the draw event????

But, otherwise, useful, need a little bit of help with it though.
  • 0

#17 graves23

graves23

    Artist Solo Queue

  • New Member
  • 35 posts
  • Version:GM8

Posted 02 April 2012 - 12:11 PM

It could be either more simple man!
Anyway good job!
  • 0

#18 hobbitbabes

hobbitbabes

    GMC Member

  • GMC Member
  • 98 posts
  • Version:GM:Studio

Posted 17 May 2012 - 02:56 PM

i found one solution to the problem first open m studio and update to todays update although the update as of today still has not fixed this bug the way i resolved the issue was with gm studio open browse to program file/java/jdk(version numbers)/bin/ then find jarsigner and run it...

a window will briefly open then close and now recreate the .apk then test with your android device!!!

this method worked flawlessly for me so i am hoping it will for others too!!

p.s cant wait for the full release cause the watermark while playing my newly created game is soooo annoying!! :mad:

my bad wrong topic lol!! please remove!!

Edited by hobbitbabes, 17 May 2012 - 02:57 PM.

  • 0

#19 Truth_

Truth_

    GMC Member

  • New Member
  • 6 posts
  • Version:Unknown

Posted 19 November 2012 - 09:02 PM

The problem with this tutorial, and most others I have come across, is that it assumes you know what you're doing. That's fine if it's targeted at proficient GM users, but not for newbies.

*The tutorial starts off by saying "Make a sprite." Well who knows what a sprite is, and how to create it? Luckily I knew both.
*Then it says "Customize the transparency, precise collision checking, smooth edges, and preload texture to whatever you need (keep the bounding box on Automatic, however)." I have no idea what any of that is, and don't see an easy way to change them (or why I'd want to).
*Next it mentions creating a room. It says to click on the "instance." Well what's that? It also says to Ctrl+RMB to create code. Well Ctrl_RMB actually deletes it (Alt+RMB opens the menu). It tells you what code to write, but doesn't explain what it means, and why it does what it does.
*Then it says "Open the Object Properties window for the object obj_menu_choice. When it Is clicked, then you want to execute the code provided previously (room_goto(rm_play)). In the Mouse Left Pressed Event, insert the code: execute_string(code);. Well how do I execute the code provided previously? Do you mean I want the program to do it, or do I have to write that code again somewhere? It doesn't explain how to create a Mouse Left Pressed Event (luckily it's fairly easy to figure out if you know it exists). When typing in the code "execute_string(code);" the program marks it as red (and running the game causes an error). What's that about?

I can't bother to go further since I really don't know what I've done thus far, and I think I've done it all wrong. I'm trying to make a relatively simple text-based game that is just a series of text-boxes asking you to answer questions which progresses the story/adventure (and hopefully affects some basic values like health, and perhaps includes a basic text-based inventory). Is this tutorial even right for me? Any other suggestions?
  • -1

#20 DiViSoR

DiViSoR

    GMC Member

  • New Member
  • 1 posts
  • Version:GM8

Posted 17 December 2012 - 08:31 AM

Hmm i got error.
Error in code at line 25:
   draw_text(mean(left,right),mean(top,bottom),text);
                                               ^
at position 46: Unknown variable text

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users