Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
Chinless Miracle
14
Years of Service
User Offline
Joined: 16th Feb 2012
Location:
Posted: 20th Feb 2012 16:24
Having difficulty with my menu,
when i goto the instruction screen it just show the orignal menu wihtout pasting the instruction screen on top


Any help would be appreciated

Thanks, and goodnight.
Seppuku Arts
Moderator
21
Years of Service
User Offline
Joined: 18th Aug 2004
Location: Cambridgeshire, England
Posted: 20th Feb 2012 19:09 Edited at: 20th Feb 2012 19:10
Could we get a look at what inside of your instructions label? The problem could be occurring inside there.


Generally I advised against 'GOTO' commands, though I do use them on the rare occasion myself, the trouble is they can lead to 'spaghetti' code, so it's always worth being aware of it. I could explain how you might do menus using functions if you think it'd be more helpful for you.


Millenium7
21
Years of Service
User Offline
Joined: 13th Dec 2004
Location:
Posted: 20th Feb 2012 20:03
+1 to the above, need to see a bit more of your code

I also suggest moving your menu code completely into a function, even going as far as having the function control what you are clicking on. I'll post a more detailed example tomorrow showing what I mean
Seppuku Arts
Moderator
21
Years of Service
User Offline
Joined: 18th Aug 2004
Location: Cambridgeshire, England
Posted: 20th Feb 2012 20:38 Edited at: 20th Feb 2012 23:08
Here's your code, but using functions instead of gotos. Except I've left 'new_game' as a goto because I've done exactly the same in my program and also to show that gotos aren't as evil as people make them out to be. I use labels in my main source code for different sections like 'NEW_GAME', 'LOAD_GAME', 'LOAD_LEVEL' and 'START' and my code isn't messy and it works perfectly fine. Things like menus, I stick to functions, they're nice and tidy, especially as soon as the code grows in complexity.

Basically all you need to do is call 'Menu()' when you want your menu to appear and if you want the instructions to appear you just need to call 'Instructions()', I don't know what your instructions code is, but I just made it up for this example.




MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 21st Feb 2012 02:05
Seppuku Arts email me!!!

need to speak with you via email if you dont mind...

I would love help with menus etc, but want to keep in touch with you if thats ok

Seppuku Arts
Moderator
21
Years of Service
User Offline
Joined: 18th Aug 2004
Location: Cambridgeshire, England
Posted: 21st Feb 2012 03:14
Sent.


MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 21st Feb 2012 03:25
Replied.

Millenium7
21
Years of Service
User Offline
Joined: 13th Dec 2004
Location:
Posted: 21st Feb 2012 06:05 Edited at: 21st Feb 2012 06:17
Here's the function from my game used for handling any 2d overlay's, from the main menu, to game lobby's, to ingame hud.

It's called every single loop, but only displays what it should according to your current 'menu' and 'selection'
I'm going to optimise it a bit further down the track, but the basic operation is there and it's been bug free for me so far
Code might look a little daunting at first, just copy and paste it into a new project and run it (requires no media) and click on things, you'll find how it works
Note: requires Advanced2D
Note2: supports WASD/Arrows/Mouse click for menu selections and modifying values
Note3: supports key/mouseclick locking, keyboard type rate (with delay)
Note4: if you wish to hide the menu simply set MenuSelection(0)="" anywhere within your gamecode, to display a menu again you set MenuSelection(0) to whichever menu you want to pull up. Because it's running every single loop, any menu can be displayed at any point in time. It also will 'not' stop your game from running in the background and will simply overlay onto the top of it. Ah the beauty of functions

MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 21st Feb 2012 06:18
wow that got me thinking of 'states'
how to get Advanced 2D is that the official add-on? 2D Plugin kit?

Millenium7
21
Years of Service
User Offline
Joined: 13th Dec 2004
Location:
Posted: 21st Feb 2012 06:38 Edited at: 21st Feb 2012 06:39
advanced2d is a 3rd party plugin for rendering text as sprites
http://forum.thegamecreators.com/?m=forum_view&t=179096&b=5

you can simply use the 'text' commands, which I was when I first wrote the function. But because I was changing fonts/text sizes/colours all the time it was verrrrryyyyy slow, as is the nature of those commands in DBPro. A2D allows me to use multiple fonts/colours/styles/sizes without having to reset them, the result is code that runs about 500x faster

p.s. I just noticed you'll also need matrix1utils for a couple commands in my function (hitimer and 'zones')
they can be replaced with standard dbpro commands
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 21st Feb 2012 07:03
fixed link

Nice... yeah I have now embraced MatrixUtils... going to look at A2D now and see if I download it or now...

I have been considering the prospect of using 3D textured objects for a menu actually...

Chinless Miracle
14
Years of Service
User Offline
Joined: 16th Feb 2012
Location:
Posted: 22nd Feb 2012 15:01
Thanks Seppuku Arts!
thats it working now

Thanks, and goodnight.

Login to post a reply

Server time is: 2026-07-10 19:24:40
Your offset time is: 2026-07-10 19:24:40