Godot Engine Game Development Projects
上QQ阅读APP看书,第一时间看更新

Node setup

Create a new scene and add a CanvasLayer node named HUD. A CanvasLayer node allows you to draw your UI elements on a layer above the rest of the game, so that the information it displays doesn't get covered up by any game elements like the player or the coins.

Godot provides a wide variety of UI elements that may be used to create anything from indicators such as health bars to complex interfaces such as inventories. In fact, the Godot editor that you are using to make this game is built in Godot using these elements. The basic nodes for UI elements are extended from Control, and appear with green icons in the node list. To create your UI, you'll use various Control nodes to position, format, and display information. Here is what the HUD will look like when complete: