Design question / Overlays / Popups / Scenes

Hi at all,

i’m just starting with my first game and have a gerneral design-question.

i have a main-screen with some buildings the player can click on to open a special building-menu.


(buildings are clickable)

now i look for the best-practice to make these special buildings-menus.
i think maybe 90% of the content will be identicly to every building:

my thoughts:
1 layer for each building. (much work to chance something on all buildings)
1 layer for all buildings. (easier to maintenance but difficult to programm)
instead of using a layer, making a new scene for each?

for the second case i think i have to use arrays or something to store and read the vaules for each building?

according to my understanding i shoud make the building menu such as a template… but how?

Hi,
whether you put each house on a different layer or not depends on what you want to do and also on your preferences. You don’t even need to decide that at the beginning as you can easily assign objects to different layers in the editor and through the events later.

If you have a lot of variables for each house, using an array can be a good idea (it doesn’t matter if you choose your case 1 or 2).

You can build a template for your menu by using an external layout External layouts [GDevelop wiki].

Oh great,
External Layouts was the point I was missing.

I never paid attention to it, maybe the name was confusing me, if it were named “global templates” i just had clicked on it :smile:

what i’m now trying to do:
build a layout, include it in the scene and try to load different values in the layout, according to the building witch is displayed… hard work for a beginner, but i try…

Design a single layer or scene that contains all the common elements of your building menus. This would include buttons, text fields, and other UI components that are shared across all buildings. Write a script that changes the specific details for each building when the menu is opened. AutoCAD LT drafting software. This could involve changing the text, updating the stats, or modifying the appearance based on the building type. Store the unique values for each building in arrays or dictionaries. When a building is clicked, your script can reference this data structure to populate the template with the correct information.