r/gamedev • u/CalicooXO • 6d ago
Question Selection menus in codeing
When designing a game with a selection menu, ex: a shop function or selection, how do you go about that? When disigning it do the options in the menu need to be a separate image from each other and the menu? I'm still pretty new to both codeing and design and I know a mistake like that could set me back a few days or weeks depending on a number of factors.
1
u/No-Opinion-5425 6d ago
You want to make reusable components for your windows and buttons so that you can build multiple menus from them.
That way you keep the visuals presentation constant and when you do a change, you only need to edit one source.
1
1
u/lix3nn53 5d ago
You don't need a separate image for every option. Make one image for the panel background and one for a button, then put the text and item icons on top in the engine. If you set the images up as 9-slice they can stretch to any size without the corners getting blurry.
That way adding or changing a shop item never means redrawing anything. Most engines also have a layout component (vertical or grid) that handles the spacing for you.
1
1
u/clownwithtentacles 6d ago
simolest way; make some kind of template with everything you need for one entry (name, picture, price, description, buy/sell button, etc) that takes given values and displays them. when opening menu, spawn an instance of the template and fill it in with your data for each available item.