About game menus

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By DarlesLSF

Hello all, I’m new on Godot and I want to now what is the best way to create the menus of the game? Using sprites nodes? Interface node? Because I was using Rpg maker and it worked using variables containing the X and Y positions on screen and images/sprites.

:bust_in_silhouette: Reply From: Zylann

The easiest is to use GUI nodes (aka Control nodes), because they have most features built-in. I would suggest you read the tutorials about this: Design a title screen — Godot Engine (3.1) documentation in English

:bust_in_silhouette: Reply From: Grandro

The node type you are looking for is called Control.
They are made to register and process all kinds of user input, therefore they are perfect for creating GUI’s (Graphical User Interfaces).

If you look at the documentation you will see there are alot of nodes that inherit properties and functions from the control class.
All of them are designed to be interacted with.

While the RPG Maker uses static images which are displayed infront of the scene on specific X and Y coordinates, Godot has Containers and Size Flags to arrange how the nodes are displayed on the scene.

Lets look at the HBoxContainer for this example. It arranges its children in an horizontal direction with a defined seperation (Found at the tab Custom Constants) and therefore determines the position of them. They can also affect the size of the child nodes.

Size Flags
If you look at the tab Size Flags you will see Fill, Expand, Shrink_Center and Shrink_End for both horizontal and vertical directions.
Fill: The node will take all the space it got assigned to from the parent node
Expand: The node will take as much space as possible
Shrink Center: The node will take the least space possible towards the center
Shrink End: The node will take the least space possible towards the end
(They are actually not easy to explain so you better experiment with them around for some time).

Note: Nodes which have a position, have their position relative to their parent.

With that being said, you can pick all kinds of control nodes and combine them together until you get the functionality of desire. You just have to figure out which node structure makes the most sense for positional/size behaviour and coding ease.

Good luck :slight_smile:

Thx guys, u helped me alot :smiley:

DarlesLSF | 2019-10-13 16:13