Scripts / Question on Menus

Author
Message
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 11th Jan 2018 16:41 Edited at: 11th Jan 2018 16:41
Hi guys, a quick question on changing menu screens and how to go about it.
I have now completed menu 1 of my little survival scriptset project and have button presses set up at the top of the menu working (see pic) but im alittle lost on how to use that button press to change from menu 1 to menu 2 (i already have menu 2 ready for testing)
what would be the best way to do this? hide/show, swichscript?
Thanks

Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on

Attachments

Login to view attachments
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 11th Jan 2018 19:28
Are you using sprites? If so just move them all off screen and move new ones for the next menu onto the screen.

You only need to move things that aren't common between menus.
Been there, done that, got all the T-Shirts!
PM
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 11th Jan 2018 20:28
This is looking really good Honkeyboy well done on a fantastic job
Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 11th Jan 2018 20:49
@ Amen moses yes m8 using sprites and text how do that m8 sry for being thick but I'm learning as i go only just about got this all working e.g adding globals to the menu etc etc, i do have the crafting bench and cooker scripts working just wondered if it was going to be a pain to do a second, 3rd menu for each level and a recipe page lastly or just to go with the 1 screen and lose the buttons at the top?
@Graphix cheers m8 its being constantly updated in the survival scripts W.I.P just added a load more to the collected items window on the left
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 11th Jan 2018 21:15 Edited at: 11th Jan 2018 21:20
Personally I would build the menus up from smaller elements and place them in the appropriate places when visible and move them off screen when not. Not sure if that is how you are doing it.

I would also use sprites for the text, buttons and even numbers, that way you have full control over font, colour and can layer the sprites for other effects.

For text you can either create sprites for every word and just place them where needed or make sprites for individual letters (for numbers you would have to do that any way).

Depends entirely on how fancy you want to make it look!

Here is an example from the Asteroids demo thingy.

Been there, done that, got all the T-Shirts!
PM
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 11th Jan 2018 21:37 Edited at: 11th Jan 2018 21:39
Erm lol that doesnt look like mine rofl and its at 700 lines now using text sprites and buttons, so i think maybe I'll try to cram the resourses into 1 page and use the crafted items e.g the workbench, cooker etc to make the more complex items but i'll wait until ive churned through this lot just the chemicals to do maybe then a crafting machine to make guns and thats probebly good enough for people to make a reasonable survival game. TBH m8 I'm suprised at what i have achieved already considering where it started. spent a few hours reading up on that math page you posted pretty cool stuff
Gonna post it all up pretty shortly and let everone abuse it to death
lol i could always use a prompt on them saying "guess what this button doesnt do anything it just looks cool" lol
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 12th Jan 2018 09:45 Edited at: 12th Jan 2018 10:00
Put each menu page in a separate state then when you click a button change to the desired state.
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 12th Jan 2018 09:52 Edited at: 12th Jan 2018 10:04
Also text should disappear as soon as its not being called anymore so you can ignore that, you only need to deal with the sprite hiding stuff but you can even use PasteSpritePosition which has the same effect as the text, that would make swapping screens much easier.

Edit.
Something like this
If gmousex > 1 and mousex < 5 then -- button 1
Page = 1
Else if mousex etc

End

If page == 1 then
Panel(50,60,60,70)
Text(51,61,1,"item1")
PasteSpritePosition(sprite1,59,61)
Etc
Elseif page == 2 then
Repeat for page 2
End

P.s. sorry on phone so code is wrong, too hard to fight with autocorrect and capitals
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 12th Jan 2018 11:58
Thats fine smallg thanks m8, I'm sticking with page 1 for now i seem to have been able to cram it all in (for now) will get that part complete and working first, running before walking!
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on

Login to post a reply

Server time is: 2024-05-08 13:15:44
Your offset time is: 2024-05-08 13:15:44