• 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 a MENU for a Game when programming with Godot

AnonyViet by AnonyViet
August 6, 2024
in Tips
0

Continued 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 an interface to see the characters and scenes of the game. Today we will set up UI, specifically Create MENU for the game using Godot Engine.

Join the channel Telegram belong to AnonyViet 👉 Link 👈

You create new sence for yourself

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

Select User Interface > Rename to TitleMenu or whatever you want

Find yourself VboxContainer

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

Here Vboxcontainer is the Node which will contain the nodes for your ui

Pay attention to the Margin section in the settings

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

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 setting it up

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

Next find yourself a TextureRect and change it to Logo

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

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

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

And here is when I finished creating it.

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

Click Download the Image to download.

Then add to game folder

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

Then you drag the logo into the texture of Node Logo.

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

It is quite command in stretch Node select: Keep Centered

It will come out in the middle

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

And create for yourself 1 more node called HboxContainer and rename it TrungTam

And this node will contain your buttons.

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

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

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

Create another VboxContainer in TrungTam and Click Expand for both Hoz and Ver

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

Next is the button

Create your own Node Button under VboxContainer

And create Node Label under Node Button(New Game)

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

Notice the black part below the Logo.

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

In Button(New Game) Click Flat and it will disappear

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

And Next we will add Custom Font to it

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

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

Then click on Dynamic Font

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

In Font Data > Empty > Load > select your font

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

Download link at the bottom of the article

In the Settings section, adjust the size to fit.

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

Next, we will save the font so that we can use it conveniently later if needed.

Right click on dynamic font > save

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

Save as .tres

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

And next we will create the effect, first write the text:

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

Custom Constans section > click 2 shadows above and below

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

Click Font Color Shadow > edit color

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

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

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

Layout section > select full rect

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

And now we will duplicate the button to make it easier to create more.

Save as sence for me. Save anywhere. But I recommend creating folders for ease. Before, when I first learned to do projects, I didn't know how to save folders and just left them all there. When I looked for them, it was like looking for a needle in a haystack =))

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

Open the saved Sence

Select sence > new Inherited Sence

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

Then click on New Game then click open

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

It will give you a sence copy

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

Renamed to TiepTuc

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

Then make another copy of Exit Game

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

Then add the Settings

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

New instance

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

Add 3 newly created ones

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

Done it like this:

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

Oh, I forgot to correct it for you guys :vv

Go to the 4 created scenes, find Rect > Min Size > change as shown in the picture and when you do one, it will apply to all 4.

If there is anything that the min size does not change, you can change it.

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

New game has changed

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

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

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

Done

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

Add Center Container for me under the Trungtam node. This Center node will be the node used to upload images next to the other 4 buttons.

And also expand for it

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

Then add texture rect then put your logo in

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

Create a label in VBoxContainer

Label Fill and Expand in vertical

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

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

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

Create like before

Adjust size to fit your eyes

Click to select 2 boxes: use mipmaps and use filter

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

Next add background

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

And we got 1 Menu

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

This menu is almost complete. The Continue – Installation part will be guided in the next 4-8 lessons.

New game + exit game will be Coded right after

Create yourself a script at new game

Then code as below

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

The above code allows you to insert the sense you want to point to into the button.

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

You can put the sence in like the picture above

And next

We will connect it

Click Node > Pressed() > connect

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

Select the node you want to connect to.

Here I connect with New game so i will connect to new game

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

This is the signal to the node.

Connect pressed() means that when you press the new game button, it will transmit a signal to the Node to receive data and then perform your actions.

This is after connect it will give us a function

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

The code is as follows:

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

Get_tree().change_sence() is a command that helps you change the sence.

Change_sence() has 2 types:

1 is the type in the image above declaring 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 the sentence”)

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

And next we will create scripts for the remaining 3 and also connect as above and code as above, except for the game exit which does not need coding.

Do the same for 3 times. New game – continue- install

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

To exit the game, do the following:

Also reconnect

And the code is as follows

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

Get_treE().quit() means that when you click on it, it will quit the game.

And then put the scene in and you're done.

Note: Do not put Sence in for Installation and Continue. I will guide you through that later.

I will put sense world in

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

Next comes the part of setting the main scene when F5 it will run the scene that has been set.

Project > Project Settings > Run > Main Sence > Click on Folder Icon

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

Select the menu screen we just made.

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

And press F5 it will run your sence

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

Previous Post

How to turn off message typing notification on Messenger

Next Post

5 settings to disable on Windows 11 to avoid being tracked

AnonyViet

AnonyViet

Related Posts

Instructions for registering for free Google AI Ultra + Youtube Premium
Tips

Instructions for registering for free Google AI Ultra + Youtube Premium

November 18, 2026
How to create a virtual Android phone with US IP for free forever
Tips

How to create a virtual Android phone with US IP for free forever

November 17, 2026
Instructions for buying a free .com domain name on Checkdomain
Tips

Instructions for buying a free .com domain name on Checkdomain

November 16, 2026
Test how well ChatGPT understands you with the box
Tips

Test how well ChatGPT understands you with the box

November 15, 2026
Grand Valley – Website to watch trains run, listen to relaxing lofi music
Tips

Grand Valley – Website to watch trains run, listen to relaxing lofi music

November 14, 2026
Instructions on how to turn off the blue dot on the MacBook screen
Tips

Instructions on how to turn off the blue dot on the MacBook screen

November 13, 2026
Next Post
5 settings to disable on Windows 11 to avoid being tracked

5 settings to disable on Windows 11 to avoid being tracked

0 0 votes
Article Rating
Subscribe
Login
Notify of
guest

guest

0 Comments
Oldest
Newest Most Voted

Recent News

SubPeek – Extension to find vietsub on Youtube right on the thumbnail

SubPeek – Extension to find vietsub on Youtube right on the thumbnail

November 19, 2026
Fun Learning for Children: Great app for learning letters and math for grade 1 for children

Fun Learning for Children: Great app for learning letters and math for grade 1 for children

November 18, 2026
Instructions for registering for free Google AI Ultra + Youtube Premium

Instructions for registering for free Google AI Ultra + Youtube Premium

November 18, 2026
How to create a virtual Android phone with US IP for free forever

How to create a virtual Android phone with US IP for free forever

November 17, 2026
SubPeek – Extension to find vietsub on Youtube right on the thumbnail

SubPeek – Extension to find vietsub on Youtube right on the thumbnail

November 19, 2026
Fun Learning for Children: Great app for learning letters and math for grade 1 for children

Fun Learning for Children: Great app for learning letters and math for grade 1 for children

November 18, 2026
Instructions for registering for free Google AI Ultra + Youtube Premium

Instructions for registering for free Google AI Ultra + Youtube Premium

November 18, 2026
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

SubPeek – Extension to find vietsub on Youtube right on the thumbnail

SubPeek – Extension to find vietsub on Youtube right on the thumbnail

November 19, 2026
Fun Learning for Children: Great app for learning letters and math for grade 1 for children

Fun Learning for Children: Great app for learning letters and math for grade 1 for children

November 18, 2026
  • Home
  • Home 2
  • Home 3
  • Home 4
  • Home 5
  • Home 6
  • Next Dest Page
  • Sample Page

say88 tỷ lệ kèo nhà cái kèo nhà cái 5 febet

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

say88 tỷ lệ kèo nhà cái kèo nhà cái 5 febet

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