• Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
AnonyViet - English Version
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
No Result
View All Result
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
No Result
View All Result
AnonyViet - English Version
No Result
View All Result

[Lập Trình Game] Lesson 9: Create MENU for Game when programming with Godot

AnonyViet by AnonyViet
February 2, 2023
in Tips
0

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

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 62

Select User Interface > Rename TitleMenu or whatever you want

Find yourself VboxContainer

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 63

Here Vboxcontainer is Node which will contain nodes for your ui

Notice the Margin section in the settings

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 64

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

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 65

Next find yourself a TextureRect and change it to Logo

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 66

Here we will put our logo in. If you don’t have a logo, you can go to the website below to create one

Links: http://www.webestools.com/web20-title-generator-logo-title-maker-online-web20-effect-reflect-free-photoshop.html

And this is when I finished creating it

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 67

You click Download the Image to download

Then add it to the game folder

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 68

Then you drag the logo into the texture of Node Logo

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 69

It is quite commanding in the stretch Node selection: Keep Centered

It will come out between

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 70

And create for me one more node called HboxContainer and rename it TrungTam

And this node will contain your buttons

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 71

Find SizeFlags and select Expend for both Hoz and Ver in the HboxContainer settings

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 72

Create 1 more VboxContainer in Trung Tam and Click Expand for both Hoz and Ver

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 73

Next is the button

Create your own Node Button under VboxContainer

And create Node Label under Node Button(Tro Choi Moi)

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 74

Notice that you will see the black part below the Logo

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 75

In Button(Tro Choi Moi) Click on Flat it will disappear

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 76

And Next we will add Custom Font for it

Label > Custom Fonts > Click Font > Then Click Empty > select Dynamic Font

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 77

Then click on Dynamic Font

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 78

In Font Data > Empty > Load > choose your font

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 79

Download link at the bottom of the post

In the Settings section, adjust the size to fit

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 80

Next we will save the font so that we can take it out later if needed

Right click on dynamic font > save

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 81

Save as .tres

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 82

And next we will create the effect, let’s first write the text in:

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 83

Custom Constants > click the 2 upper and lower shadows

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 84

Click Font Color Shadow > edit color

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 85

And we will be like this. You can also edit the color

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 86

Layout section > select full rect

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 87

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. =))

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 88

Open the saved Sense

Select sence > new Inherited Sense

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 89

Then tap Game of Thrones then press open

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 90

It will give you a sense copy

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 91

Renamed TiepTuc

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 92

Then make another copy of Exit Game

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 93

Then add another Settings

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 94

New Instance Sense

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 95

Add the 3 just created

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 96

Done it like this:

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 97

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

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 98

New game changed

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 99

Next are the other 3. Do all 3 > Rect > min size > press the circle rs

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 100

Done

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 101

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

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 102

Then add texture rect then put your logo in

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 103

Create a label in VBoxContainer

Label Fill and Expand in vertical

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 104

Create a new dynamic font because here we will create a different font size

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 105

Just create it like before

Adjust the size to fit your eyes

Click on 2 boxes: use mipmaps and use filter

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 106

Next add the background

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 107

And we got 1 Menu

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 108

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

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 109

The above code helps you to remove the sense you want to point to the button

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 110

You can put the sense in like the picture above

And next

We will connect it

Click Node > Pressed() > connect

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 111

Which node do you connect with, choose that node?

Here I connect with Gameplay so I will connect to play games

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 112

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

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 113

The code is as follows:

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 114

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”)

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 115

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

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 116

And in the game, do the following

Also reconnect

And the code is as follows

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 117

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

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 118

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

[Lập Trình Game]  Lesson 9: Creating MENU for Game when programming with Godot 119

Select the menu screen that we did just now

[Lập Trình Game]  Lesson 9: Create MENU for Game when programming with Godot 120

And press F5 it will run your sense

And that’s it :3. See you in the next post hehe

The article achieved: 5/5 – (100 votes)

Tags: createGameGodotlậpLessonmenuProgrammingtrình
Previous Post

Download DLL-FILES FIXER 3.3.91 – DLL library supplement software

Next Post

[Lập Trình Game] Display FPS for games using Godot Engine

AnonyViet

AnonyViet

Related Posts

Instructions on how to format text on the Windows 11 notepad
Tips

Instructions on how to format text on the Windows 11 notepad

August 16, 2025
4 ways to fix bluetooth connectivity on Windows 11
Tips

4 ways to fix bluetooth connectivity on Windows 11

August 8, 2025
How to know the computer is tracked and processed by Keylogger
Tips

How to know the computer is tracked and processed by Keylogger

August 7, 2025
Opal: Create applications who do not need to write code
Tips

Opal: Create applications who do not need to write code

August 3, 2025
How to activate a new Start menu on Windows 11
Tips

How to activate a new Start menu on Windows 11

July 29, 2025
Intellgpt: AI tool for osint and data science
Tips

Intellgpt: AI tool for osint and data science

July 28, 2025
Next Post
[Lập Trình Game] Display FPS for games using Godot Engine

[Lập Trình Game] Display FPS for games using Godot Engine

0 0 votes
Article Rating
Subscribe
Login
Notify of
guest

guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Recent News

Instructions on how to format text on the Windows 11 notepad

Instructions on how to format text on the Windows 11 notepad

August 16, 2025
Instructions for receiving 80GB of free data from VinaPhone from August 15

Instructions for receiving 80GB of free data from VinaPhone from August 15

August 15, 2025
Online driving exam preparation: Support theory and practice

Online driving exam preparation: Support theory and practice

August 15, 2025
How to add application to your favorite bar

How to add application to your favorite bar

August 14, 2025
Instructions on how to format text on the Windows 11 notepad

Instructions on how to format text on the Windows 11 notepad

August 16, 2025
Instructions for receiving 80GB of free data from VinaPhone from August 15

Instructions for receiving 80GB of free data from VinaPhone from August 15

August 15, 2025
Online driving exam preparation: Support theory and practice

Online driving exam preparation: Support theory and practice

August 15, 2025
AnonyViet - English Version

AnonyViet

AnonyViet is a website share knowledge that you have never learned in school!

We are ready to welcome your comments, as well as your articles sent to AnonyViet.

Follow Us

Contact:

Email: anonyviet.com[@]gmail.com

Main Website: https://anonyviet.com

Recent News

Instructions on how to format text on the Windows 11 notepad

Instructions on how to format text on the Windows 11 notepad

August 16, 2025
Instructions for receiving 80GB of free data from VinaPhone from August 15

Instructions for receiving 80GB of free data from VinaPhone from August 15

August 15, 2025
  • Home
  • Home 2
  • Home 3
  • Home 4
  • Home 5
  • Home 6
  • Next Dest Page
  • Sample Page

©2024 AnonyVietFor Knowledge kqxs hôm nay xem phim miễn phí mm88 8XBET mm88 trang chủ new88

No Result
View All Result
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office

©2024 AnonyVietFor Knowledge kqxs hôm nay xem phim miễn phí mm88 8XBET mm88 trang chủ new88

wpDiscuz
0
0
Would love your thoughts, please comment.x
()
x
| Reply