In this video, we add the sky, health bar, and open a room scene to flesh it out with a chest and pickups.
For the health bar to stay on the screen, it needs to be a child of the node name UILayer in your Scene dock.
Two lines are crossing in the editor’s viewport: a red and a green line.
The place where they cross represents the origin of the game level. For UI, it represents the top-left corner of the game’s window at runtime.
Your health bar should be placed below and to the right of that point to appear on the screen.
In this series, we turned on grid snapping to precisely place some nodes. If you want to place some items freely, you first need to turn off grid snapping by clicking the magnet icon in the toolbar above the viewport.
You can also toggle grid snapping using the keyboard shortcut Shift+g.
The UIHealthBar stays at a fixed position on the screen when running the game.
This is due to its parent node, the UILayer.
This rendering layer does two things for us:
You’ll see how we’ll get to use rendering layers in our projects later in the course.
In the next and last video, you’ll write your first line of code.