Let’s Learn Godot 4 by Making an RPG — Part 7: Setting Up The Game GUI #3🤠
Tags: gamedev, beginners, tutorial, learning
Published: 2023-06-26 06:21:39


In our two previous parts, we created the UI elements for our health and stamina values, as well as our pickups. In the final part of our GUI section, we are going to create the elements needed to display our player’s Level and XP values.

---

>  **WHAT YOU WILL LEARN IN THIS PART:**
>  · How to add UI elements to your scene more hands-off.
>  · How to position labels.
>  · How to change the fonts and anchoring of nodes.

---

## LEVEL & XP UI

We aren’t going to add any code to update this yet because we first need to create an enemy for that first. Let’s go ahead and create these elements now.

In your Player scene, let’s add a new ColorRect to our UI node. Rename this node to XP and add two Label nodes to it. Rename the second Label node to “Value”.

![Godot Learning RPG](https://cdn-images-1.medium.com/max/2000/1*ym41n2KYTewz-pG4IhvN4w.png)

With your XP node selected, change its Color property to #3a39356a, and its transform properties to the following:

![Godot Learning RPG](https://cdn-images-1.medium.com/max/2000/1*2LrVuMw-dKRcqzz4txodsA.png)

Change the font of your two label nodes to ARCADECLASSIC, and the font size to 15.

![Godot Learning RPG](https://cdn-images-1.medium.com/max/2000/1*JyvUPxIfdKQYzJ3mo1Q3cw.png)

Change the text of your Label to “XP:” and the text of your Value to “0/100”.

![Godot Learning RPG](https://cdn-images-1.medium.com/max/2000/1*6xbAz62Bbo3_q3eilxyRyg.png)

Then, change the anchor preset of the Label node to center-left. Change its properties to the following:

![Godot Learning RPG](https://cdn-images-1.medium.com/max/2000/1*t-bRZCtRTRR2BquQct_q6w.png)

Do the same for the Value node but change it to center-right. Change its properties to the following:

![Godot Learning RPG](https://cdn-images-1.medium.com/max/2000/1*ABNcE8DlAkR8WBk4bzIQZg.png)

Duplicate your XP node with all of its children and rename it to “Level”.

![Godot Learning RPG](https://cdn-images-1.medium.com/max/2000/1*ZM_96qvm3XL_q7jnz2MuGg.png)

Change the Level node’s transform properties to the following:

![Godot Learning RPG](https://cdn-images-1.medium.com/max/2000/1*ZqqTdNspVlJ7xtScgS-H0g.png)

Finally, change the text of your Label to “Level:” and the text of your Value to “1”.

![Godot Learning RPG](https://cdn-images-1.medium.com/max/2000/1*FM79M3k05IjBkSCs0MFsgw.png)

**Your result should look like this:**

![Godot Learning RPG](https://cdn-images-1.medium.com/max/2460/1*lQc5H1bpmWxvWJWHk9p1tg.png)

And that’s it for this game GUI. I know this was a very long three-parter, but in the next part, we at least will be able to do something a bit more fun when we create our Ammo and Consumable Pickups! Remember to save and backup your game project, and I’ll see you in the next part.

Your final code for this part should look like [this.](https://github.com/christinec-dev/DustyTrails_RPG_Parts/tree/main/Part_7)

---
### FULL TUTORIAL

![Godot RPG](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pd9n6khb9jtaj0bynp7e.png)

The tutorial series has 23 chapters. I’ll be releasing all of the chapters in sectional daily parts over the next couple of weeks.

If you like this series or want to skip the wait and access the offline, full version of the tutorial series, you can support me by buying the offline booklet for just $4 on [Ko-fi!](https://ko-fi.com/s/19c32424e5)😊

You can find the updated list of the tutorial links for all 23 parts in this series [here.](https://oops-i-devd.gitbook.io/oops-i-devd/godot-tutorials/dusty-trails/tutorial)