I'm very new to LOVE. I only started 9/30/12!
But I'm starting a game now and I would like to start with the menu and stuff, Then gameplay.
So first. How do I make An options menu?
For example I would like the user to be able to tell the game "Please change line2 to 220942804920!".
When the player chooses a choice for the screen resolution the game would edit the line screen resolution is defined and edit those numbers to what the use inputted. Thanks in advance!
please help make an options menu!
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: please help make an options menu!
Welcome!
What do you have so far? Could you upload a .love? Then we can make better suggestions. Right now we can only either say very vague and general things (which won't help you) or do everything for you (which won't help you either).
If you want to help yourself, it's always a good idea to look around on the forums, and read the source of games other people have made.
What do you have so far? Could you upload a .love? Then we can make better suggestions. Right now we can only either say very vague and general things (which won't help you) or do everything for you (which won't help you either).
If you want to help yourself, it's always a good idea to look around on the forums, and read the source of games other people have made.
Help us help you: attach a .love.
Re: please help make an options menu!
Hey, Well not sure if i'm in the position to answer your question since i'm not a programmer (what the hell am i doing here anyway)
But structure wise, the way i'd do it is tell the game to take it's information from a text file .txt or .ini
like resolution , antialiasing , texture quality , mouselock and whatnot
the text file would look something like this:
That's how it's done with the game i'm working on right now and it works GREAT
You'd change the values in that text through the game or through a simple launcher...
And also in case the player sets the game to an un-supported resolution or something , he can easily fix it from the text file manually , without having to dig through the line codes or even worse, reinstall the game
Hope this helped
But structure wise, the way i'd do it is tell the game to take it's information from a text file .txt or .ini
like resolution , antialiasing , texture quality , mouselock and whatnot
the text file would look something like this:
Code: Select all
set camfactor 0.6
resolution 960x540
mouselock false
antialiasing 16
You'd change the values in that text through the game or through a simple launcher...
And also in case the player sets the game to an un-supported resolution or something , he can easily fix it from the text file manually , without having to dig through the line codes or even worse, reinstall the game
Hope this helped
Re: please help make an options menu!
Thanks!Robin wrote:Welcome!
I added it as an attachment to this reply. But i know the conf.lua already but i did not impliment it yet. so i dont need an explanation of the conf.lua.Robin wrote: What do you have so far? Could you upload a .love? Then we can make better suggestions. Right now we can only either say very vague and general things (which won't help you) or do everything for you (which won't help you either).
If you want to help yourself, it's always a good idea to look around on the forums, and read the source of games other people have made.
Re: please help make an options menu!
Well actually I had an idea just for that. when the user set the option the game wouldn't apply it permenantly. it would apply it and the screen would tell the person that they had 10 seconds to click keep this resolution. if they didnt by 10 seconds the game would then switch to the previous resolutionxelu wrote:
And also in case the player sets the game to an un-supported resolution or something , he can easily fix it from the text file manually , without having to dig through the line codes or even worse, reinstall the game
Hope this helped
Re: please help make an options menu!
Create buttons in the game (visually, draw something that looks like a button). Then check if the user clicks on that button. If so, do something. If you need for example numerical values (like screen resolution), you can either have a few presets (the most common method, used in almost all games) or you can let the user choose freely (in this case you will have to listen to keypresses from the keyboard and figure out what the user is trying to type). Only your imagination and your programming skills limit you, and both can be improved with reading, training, discussing and thinking.
If you have more specific questions, feel free to ask.
If you have more specific questions, feel free to ask.
My game called Hat Cat and the Obvious Crimes Against the Fundamental Laws of Physics is out now!
Re: please help make an options menu!
Might be a little off-topic but I would highly recommend making gameplay before menus. Not only does it make more sense from a practical standpoint, but it's also much more fun and rewarding! (at least in my experience )
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.
Re: please help make an options menu!
Ok. ill try thatLafolie wrote:Might be a little off-topic but I would highly recommend making gameplay before menus. Not only does it make more sense from a practical standpoint, but it's also much more fun and rewarding! (at least in my experience )
Re: please help make an options menu!
I agree with Lafolie's sentiment; it's much more fun and rewarding to work on the game play rather than the administrative stuff. But I know, at least for me, that it's hard to do that if you don't at least have an idea of how you might do those boring things.
I don't know if this helps you much or not, but I've been working on a menu system for myself. I was building a game and realized I needed some way to configure it (much like you) so I started this project. It's probably not the optimal solution, but it will give you an idea of what's necessary. Here's a screenshot:
Attached is a demo with a video and audio menu (very basic) and an exit function. I've used kikito's middleclass as a means of making it more object oriented. The code is fairly well documented (at least functions and their parameters). It's also got a basic input system and a 'class' that made dealing with colors easier for me. The main.lua contains the code that creates the menu.
Here is a snippet of code that sets up the video portion of the menu:
It's not enough to have a menu, you'll need some kind of game state library to make it work. If you are starting from nothing I'd suggest having a look at hump which has a good set of basic functionality (including game states). There are tons of other libraries to peruse as well. And don't be like me and totally miss the snippets section of the wiki!
The demo does not save any settings, it starts with the defaults every time you load it up.
Note: it's not quite done, but it's close enough.
I don't know if this helps you much or not, but I've been working on a menu system for myself. I was building a game and realized I needed some way to configure it (much like you) so I started this project. It's probably not the optimal solution, but it will give you an idea of what's necessary. Here's a screenshot:
Attached is a demo with a video and audio menu (very basic) and an exit function. I've used kikito's middleclass as a means of making it more object oriented. The code is fairly well documented (at least functions and their parameters). It's also got a basic input system and a 'class' that made dealing with colors easier for me. The main.lua contains the code that creates the menu.
Here is a snippet of code that sets up the video portion of the menu:
Code: Select all
menu = MinimalMenu()
-- set up an options menu.
local options = menu:addItem(nil, 'Options', nil, nil)
-- set up a video menu with fullscreen (on, off), vsync (on, off) and available resolutions
local video = menu:addItem(options, 'Video', 'Contains options about video parameters', nil)
local fullscreen = menu:addItem(video, 'Fullscreen', 'Sets the application to fullscreen', nil)
menu:addItem(fullscreen, 'On', '', function() game.mode.fullscreen = true; updateMode() end)
menu:addItem(fullscreen, 'Off', '', function() game.mode.fullscreen = false; updateMode() end)
if game.mode.fullscreen == false then fullscreen.selectedChild = 2 end
local vsync = menu:addItem(video, 'Vsync', 'Sets the vertical sync', nil)
menu:addItem(vsync, 'On', '', function() game.mode.vsync = true; updateMode() end)
menu:addItem(vsync, 'Off', '', function() game.mode.vsync = false; updateMode() end)
if game.mode.vsync == false then vsync.selectedChild = 2 end
local resolutions = menu:addItem(video, 'Resolutions', 'Select a resolution.', nil)
local modes = love.graphics.getModes()
table.sort(modes, function(a, b) return a.width*a.height < b.width*b.height end)
for _, mode in pairs(modes) do
menu:addItem(resolutions, mode.width .. 'x' .. mode.height, 'no hint',
function() game.mode.width = mode.width; game.mode.height = mode.height; updateMode() end)
end
The demo does not save any settings, it starts with the defaults every time you load it up.
Note: it's not quite done, but it's close enough.
- Attachments
-
- minimalmenu.love
- (10.38 KiB) Downloaded 249 times
Last edited by paritybit on Fri Oct 05, 2012 4:28 pm, edited 1 time in total.
- Roland_Yonaba
- Inner party member
- Posts: 1563
- Joined: Tue Jun 21, 2011 6:08 pm
- Location: Ouagadougou (Burkina Faso)
- Contact:
Re: please help make an options menu!
I really like this one. Good job!paritybit wrote: Note: it's not quite done, but it's close enough.
Well, just change line 33 in main.lua:paritybit wrote:Note2: I couldn't get the fullscreen option to work right; maybe somebody can give me a hint?
Code: Select all
love.graphics.setMode(game.mode.width, game.mode.height, game.fullscreen, game.vsync)
Code: Select all
love.graphics.setMode(game.mode.width, game.mode.height, game.mode.fullscreen, game.mode.vsync)
First, consider finding another way to highlight the selected entry. Fact is using different colors (green, white) don't make it obvious enough (to me). Maybe you can draw some glow effect, on just use some sort of alpha fading for that.
Second, maybe the of values for Audio should be more flexible.
You can locally set some vars for lower, higher values and a step value:
Code: Select all
local volume_range = {lower = 0, step = 0.5, high = 1}
Code: Select all
for vol = volume_range.lower, volume_range.high, volume_range.step do
local vol_string_percentile = (vol*100)..'%'
menu:addItem(volume,
vol_string_percentile,
(Sets the volume to %s'):format(vol_string_percentile),
function() love.audio.setVolume(vol) end)
end
That would be cool.
Okay, think I'm done with my silly suggestions. Keep up the good job.
Who is online
Users browsing this forum: Ahrefs [Bot] and 2 guests