Jibble

Author Topic: Room1 (mainmenu) related topics  (Read 84 times)

Room1 (mainmenu) related topics
« on: 23 Feb 2021, 16:17 »
Im working on a main menu, most of the functional side is done I believe

There are clickable areas for start, load, and quit in form of hotspots, they work and do what I want so far,
is this a good way to do this?
One thing I dont like with this is when I hover mouse over the hotspot areas it renders the text "Walk to Hotspot 1".
Is it possible to hide these texts only for this specific room?




Matti

Re: Room1 (mainmenu) related topics
« Reply #1 on: 24 Feb 2021, 11:12 »
I guess you're using the Tumbleweed template? I'm not sure how it works so I can't help with disabling it for a specific room.

But when creating a menu you would usually create a GUI for that. This has many advantages, as you can make it visible/invisible, rearrange it, and "start", "load" etc would be buttons that can also change sprites when you click or hover over it.
« Last Edit: Yesterday at 10:30 by Matti »

Re: Room1 (mainmenu) related topics
« Reply #2 on: 24 Feb 2021, 20:51 »
Yeah in full agreement with Matti on this.
Because it's set up like a room, it will behave like any other, so the game will expect characters to possibly be walking around and interacting in it.
Thankfully if your room is mostly set up, the code can easily be copied over, and creating a GUI for a main menu should be pretty easy. This should be a little minor change.

At the top of your global script, you should find a function called game_start(), This is where you'll want to set up your menu. Just go to the right hand menu and right click gui, then create a new gui (I'll use gMenu for example), you can then add buttons and sliders and whatever your heart desires, you can change the background image to whatever you want with the "BackgroundImage" in the properties. If you want it to fill the screen, set the size to whatever your game's resolution is. You can then place buttons and change their sprite, and have those buttons for save, start, quit.

Going back to that game_start() function, You'll want to make the code look something like this.

Code: Adventure Game Studio
  1. function game_start()
  2. {
  3.    gMenu.Centre();
  4.    gMenu.Visible = true;
  5. }
  6.  

That's it, that's all you'll need.

For buttons like Quit, save, etc, Just move the existing code,

Code: Adventure Game Studio
  1. function Save_OnClick(GUIControl *control, MouseButton button)
  2. {
  3.   SaveGameDialog();
  4. }
  5.  
  6. function Load_OnClick(GUIControl *control, MouseButton button)
  7. {
  8.   RestoreGameDialog();
  9. }
  10.  

That's all you'll need for save and load, quit game, I'll let you figure out, that's the fun of coding.

Starting your game you can do with gMenu.Visable = false; that'll just hide the menu, and let you play your game.
If you want to get technical, you can have things like PauseGame(); but that's only if you have things auto running when the game starts.

That's all your basics of menu GUI, I'm taking this from my code, which works fine, although I'm not running Thimbleweed so you may have to modify it a little, I realise it may not be too clean, but as I said you can modify to your preference, If you need me to explain any of it, I'll gladly break it down a little more, but just experiment.

That start button is a really nice asset btw, you're doing great.
The original, and best V