Continuation of the series game programming with godot In this article, I will guide you to create UI for your game. User Interface (UI) is the face of the Game, when playing the game you need to have an interface to see the characters and the scene of the game. Today we will set up the UI, specifically Create MENU for the game using Godot Engine.
| Join the channel Telegram belong to AnonyViet 👉 Link 👈 |
You guys create a new sense for yourself
Select User Interface > Rename TitleMenu or whatever you want
Find yourself VboxContainer
Here Vboxcontainer is Node which will contain nodes for your ui
Notice the Margin section in the settings
Now you have to set it up to fit the screen by adjusting the margin or dragging it out to adjust it :v.
And here is when I finished the setup
Next find yourself a TextureRect and change it to Logo
Here we will put our logo in. If you don’t have a logo, you can go to the website below to create one
And this is when I finished creating it
You click Download the Image to download
Then add it to the game folder
Then you drag the logo into the texture of Node Logo
It is quite commanding in the stretch Node selection: Keep Centered
It will come out between
And create for me one more node called HboxContainer and rename it TrungTam
And this node will contain your buttons
Find SizeFlags and select Expend for both Hoz and Ver in the HboxContainer settings
Create 1 more VboxContainer in Trung Tam and Click Expand for both Hoz and Ver
Next is the button
Create your own Node Button under VboxContainer
And create Node Label under Node Button(Tro Choi Moi)
Notice that you will see the black part below the Logo
In Button(Tro Choi Moi) Click on Flat it will disappear
And Next we will add Custom Font for it
Label > Custom Fonts > Click Font > Then Click Empty > select Dynamic Font
Then click on Dynamic Font
In Font Data > Empty > Load > choose your font
Download link at the bottom of the post
In the Settings section, adjust the size to fit
Next we will save the font so that we can take it out later if needed
Right click on dynamic font > save
Save as .tres
And next we will create the effect, let’s first write the text in:
Custom Constants > click the 2 upper and lower shadows
Click Font Color Shadow > edit color
And we will be like this. You can also edit the color
Layout section > select full rect
And now we will duplicate the button to create more for ease
Save as sence for me. Save anywhere. But I recommend making it easy, but before when I first learned to do projects, I didn’t know how to save the folder and threw a pile there until I found it like a needle in a haystack. =))
Open the saved Sense
Select sence > new Inherited Sense
Then tap Game of Thrones then press open
It will give you a sense copy
Renamed TiepTuc
Then make another copy of Exit Game
Then add another Settings
New Instance Sense
Add the 3 just created
Done it like this:
Oh, I forgot to correct it for you guys :vv
Go to the 4 sence just created, find Rect > Min Size > change like the picture and when you make one, it will apply to all 4.
If there’s something that min size doesn’t change, you don’t change it
New game changed
Next are the other 3. Do all 3 > Rect > min size > press the circle rs
Done
Add me a Center Container under node Trungtam, this Center node will be the node used to upload pictures next to the 4 buttons
And also expand for it
Then add texture rect then put your logo in
Create a label in VBoxContainer
Label Fill and Expand in vertical
Create a new dynamic font because here we will create a different font size
Just create it like before
Adjust the size to fit your eyes
Click on 2 boxes: use mipmaps and use filter
Next add the background
And we got 1 Menu
This menu is almost complete, the Continue – Installation will be guided in 4-8 more lessons
New game + exit game will be Code soon
Create yourself a script in play games
Then code like below
The above code helps you to remove the sense you want to point to the button
You can put the sense in like the picture above
And next
We will connect it
Click Node > Pressed() > connect
Which node do you connect with, choose that node?
Here I connect with Gameplay so I will connect to play games
This is signaling to node
Connect pressed() means that when the new game button is pressed, it will send a signal to the Node to receive data and then perform your actions.
This is after connecting it will give us a function
The code is as follows:
Get_tree().change_sence() is a command to help you change the scene
Change_sence() has 2 types:
1 is the type above the image declares the variable bosencevao which means you can put the sence in there and then get_tree().change_sence(bosencevao) it will point to the sence you put in
2 is get_tree().change_sence(“address of sence”)
And next we will create scripts for the remaining 3 and also connect as above and code as above, no code needed.
Do the same 3 Gameplay – continue- let’s fix it
And in the game, do the following
Also reconnect
And the code is as follows
Get_tree().quit() means that clicking it will quit the game
And then put the sense in and you’re done
Note: Separately Install and Continue Without Putting Sense In, I will guide you later
I’ll put sense world in
Next comes the set main sence when F5 will run the sence that has been set
Project > Project Settings > Run > Main Sense > Click on Folder Icon
Select the menu screen that we did just now
And press F5 it will run your sense
And that’s it :3. See you in the next post hehe
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 64 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 62](https://anonyviet.com/wp-content/uploads/2020/03/image001-1.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 65 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 63](https://anonyviet.com/wp-content/uploads/2020/03/image002.png)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 66 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 64](https://anonyviet.com/wp-content/uploads/2020/03/image003-2.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 67 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 65](https://anonyviet.com/wp-content/uploads/2020/03/image004-3.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 68 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 66](https://anonyviet.com/wp-content/uploads/2020/03/image005.png)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 69 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 67](https://anonyviet.com/wp-content/uploads/2020/03/image006.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 70 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 68](https://anonyviet.com/wp-content/uploads/2020/03/image007.png)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 71 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 69](https://anonyviet.com/wp-content/uploads/2020/03/image008-1.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 72 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 70](https://anonyviet.com/wp-content/uploads/2020/03/image009.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 73 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 71](https://anonyviet.com/wp-content/uploads/2020/03/image010.png)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 74 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 72](https://anonyviet.com/wp-content/uploads/2020/03/image011-1.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 75 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 73](https://anonyviet.com/wp-content/uploads/2020/03/image012.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 76 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 74](https://anonyviet.com/wp-content/uploads/2020/03/image013-1.png)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 77 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 75](https://anonyviet.com/wp-content/uploads/2020/03/image014-1.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 78 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 76](https://anonyviet.com/wp-content/uploads/2020/03/image015.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 79 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 77](https://anonyviet.com/wp-content/uploads/2020/03/image016.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 80 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 78](https://anonyviet.com/wp-content/uploads/2020/03/image017.png)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 81 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 79](https://anonyviet.com/wp-content/uploads/2020/03/image018.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 82 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 80](https://anonyviet.com/wp-content/uploads/2020/03/image019.png)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 83 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 81](https://anonyviet.com/wp-content/uploads/2020/03/image020.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 84 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 82](https://anonyviet.com/wp-content/uploads/2020/03/image021.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 85 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 83](https://anonyviet.com/wp-content/uploads/2020/03/image022.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 86 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 84](https://anonyviet.com/wp-content/uploads/2020/03/image023.png)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 87 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 85](https://anonyviet.com/wp-content/uploads/2020/03/image024.png)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 88 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 86](https://anonyviet.com/wp-content/uploads/2020/03/image025.png)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 89 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 87](https://anonyviet.com/wp-content/uploads/2020/03/image026.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 90 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 88](https://anonyviet.com/wp-content/uploads/2020/03/image027.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 91 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 89](https://anonyviet.com/wp-content/uploads/2020/03/image028.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 92 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 90](https://anonyviet.com/wp-content/uploads/2020/03/image029.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 93 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 91](https://anonyviet.com/wp-content/uploads/2020/03/image030.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 94 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 92](https://anonyviet.com/wp-content/uploads/2020/03/image031.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 95 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 93](https://anonyviet.com/wp-content/uploads/2020/03/image032.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 96 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 94](https://anonyviet.com/wp-content/uploads/2020/03/image033.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 97 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 95](https://anonyviet.com/wp-content/uploads/2020/03/image034.png)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 98 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 96](https://anonyviet.com/wp-content/uploads/2020/03/image035.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 99 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 97](https://anonyviet.com/wp-content/uploads/2020/03/image036.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 100 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 98](https://anonyviet.com/wp-content/uploads/2020/03/image037.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 101 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 99](https://anonyviet.com/wp-content/uploads/2020/03/image038.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 102 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 100](https://anonyviet.com/wp-content/uploads/2020/03/image039.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 103 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 101](https://anonyviet.com/wp-content/uploads/2020/03/image040.png)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 104 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 102](https://anonyviet.com/wp-content/uploads/2020/03/image041.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 105 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 103](https://anonyviet.com/wp-content/uploads/2020/03/image042.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 106 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 104](https://anonyviet.com/wp-content/uploads/2020/03/image043.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 107 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 105](https://anonyviet.com/wp-content/uploads/2020/03/image044.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 108 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 106](https://anonyviet.com/wp-content/uploads/2020/03/image045.png)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 109 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 107](https://anonyviet.com/wp-content/uploads/2020/03/image046.png)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot](https://anonyviet.com/wp-content/uploads/2020/03/image047.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 111 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 109](https://anonyviet.com/wp-content/uploads/2020/03/image048.png)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 112 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 110](https://anonyviet.com/wp-content/uploads/2020/03/image049.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 113 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 111](https://anonyviet.com/wp-content/uploads/2020/03/image050.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 114 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 112](https://anonyviet.com/wp-content/uploads/2020/03/image051.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 115 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 113](https://anonyviet.com/wp-content/uploads/2020/03/image052.png)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 116 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 114](https://anonyviet.com/wp-content/uploads/2020/03/image053.png)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 117 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 115](https://anonyviet.com/wp-content/uploads/2020/03/image054.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 118 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 116](https://anonyviet.com/wp-content/uploads/2020/03/image055.jpg)
![[Lập Trình Game] Lesson 9: Creating MENU for Game when programming with Godot 119 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 117](https://anonyviet.com/wp-content/uploads/2020/03/image056.png)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 120 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 118](https://anonyviet.com/wp-content/uploads/2020/03/image057.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 121 [Lập Trình Game] Lesson 9: Creating MENU for Game when programming with Godot 119](https://anonyviet.com/wp-content/uploads/2020/03/image058.jpg)
![[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 122 [Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot 120](https://anonyviet.com/wp-content/uploads/2020/03/image059.jpg)
![[Godot RPG] #4 : Tilemap [Godot RPG] #4 : Tilemap](https://anonyviet.com/wp-content/uploads/2021/02/16-02-2021-11-26-35.png)





![[Lập Trình Game] Display FPS for games using Godot Engine [Lập Trình Game] Display FPS for games using Godot Engine](https://anonyviet.com/wp-content/uploads/2020/03/FPS-godot-engine.jpg)
