• 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 12: Creating HP for Enemy in Godot Engine

AnonyViet by AnonyViet
July 7, 2024
in Tips
0

Continuing with the enemy, in this lesson we will create hp for the enemy and this lesson is quite short, in the next lesson I will guide you to create slash animation (because the available assets of anonyviet do not have slash animation so I will use another animation and if anyone uses another asset that has attack animation then just use it) and destroy the enemy.

Join the channel Telegram belong to AnonyViet 👉 Link 👈

USE EXPORT

Go to the enemy script section and declare your HP variable.

I will declare that:

export var hp = 2

Use export to declare HP variable

And Export here is the declaration command to bring the value out of the table. Properties to edit

Properties panel to edit

You can also do the same with variables if you want and Export it has nothing to do with your code, it only has the function of bringing the variable value out for easier editing without having to edit the code.

[Lập Trình Game] Lesson 12: Creating HP for Enemy in Godot Engine

And you can apply this to many other things.

Here I will guide you a trick to choose something like color, etc.

color changing code

Export (String,”text”) var variablename is to be

Here if you want to change the color you code as follows:

if ColorMode == "Mau Do":
    $Sprite.modulate = Color(0, 0, 1, 1)
elif ColorMode == "Mau Xanh":
    $Sprite.modulate = Color(0.75, 0.75, 0.75, 1)
elif ColorMode == "Mau Cua Anonyviet":
    print(“Dep Trai Khong Bao Gio Sai)

If statement to compare what color is selected

$Call sprite or AnimationSprite or whatever and modulate to change the color

[Lập Trình Game]  Lesson 12: Creating HP for Enemy in Godot Engine

You can func create a function containing the color change command and then call the color change function in physics or process

For example:

# ham process goi du lieu ben trong tren tung khung hinh	
Func _process(delta):
#goi set color
Setcolor()
# ham set color
Func setcolor():
    if ColorMode == "Mau Do":
        $Sprite.modulate = Color(0, 0, 1, 1)
    elif ColorMode == "Mau Xanh":
        $Sprite.modulate = Color(0.75, 0.75, 0.75, 1)
    elif ColorMode == "Mau Cua Anonyviet":
        print(“Dep Trai Khong Bao Gio Sai)
Previous Post

What is Eres El Amor De Mi Vi?

Next Post

How to set password for Android app

AnonyViet

AnonyViet

Related Posts

Cách Đăng ký Nhận Code ChatGPT Business
Tips

Cách Đăng ký Nhận Code ChatGPT Business

November 2, 2026
Instructions for cleaning LG TV with Antigravity to help it run faster
Tips

Instructions for cleaning LG TV with Antigravity to help it run faster

October 30, 2026
Quét lỗ hổng bảo mật cho Vide Coding bằng Security Audit Skill
Tips

Quét lỗ hổng bảo mật cho Vide Coding bằng Security Audit Skill

October 27, 2026
Instructions for registering for OxionAI Pro for 1 year with many powerful AI models
Tips

Instructions for registering for OxionAI Pro for 1 year with many powerful AI models

October 24, 2026
How are Windows 11 Pro and Windows 10 Pro different?
Tips

How are Windows 11 Pro and Windows 10 Pro different?

October 23, 2026
Instructions for using CleanYourTV: Remove ads on Android TV, Google TV
Tips

Instructions for using CleanYourTV: Remove ads on Android TV, Google TV

October 23, 2026
Next Post
How to set password for Android app

How to set password for Android app

0 0 votes
Article Rating
Subscribe
Login
Notify of
guest

guest

0 Comments
Oldest
Newest Most Voted

Recent News

Tool to get transcript of entire YouTube channel extremely fast and free

Tool to get transcript of entire YouTube channel extremely fast and free

November 10, 2026
Keysoff 11.11 discount: Office 2024 Pro only .58, Windows 11 Pro from .58

Keysoff 11.11 discount: Office 2024 Pro only $26.58, Windows 11 Pro from $15.58

November 9, 2026
How to create an Android App using Google AI Studio without code

How to create an Android App using Google AI Studio without code

November 9, 2026
Holding OPPO Find X10 to watch movies all night: Real experience

Holding OPPO Find X10 to watch movies all night: Real experience

November 9, 2026
Tool to get transcript of entire YouTube channel extremely fast and free

Tool to get transcript of entire YouTube channel extremely fast and free

November 10, 2026
Keysoff 11.11 discount: Office 2024 Pro only .58, Windows 11 Pro from .58

Keysoff 11.11 discount: Office 2024 Pro only $26.58, Windows 11 Pro from $15.58

November 9, 2026
How to create an Android App using Google AI Studio without code

How to create an Android App using Google AI Studio without code

November 9, 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

Tool to get transcript of entire YouTube channel extremely fast and free

Tool to get transcript of entire YouTube channel extremely fast and free

November 10, 2026
Keysoff 11.11 discount: Office 2024 Pro only .58, Windows 11 Pro from .58

Keysoff 11.11 discount: Office 2024 Pro only $26.58, Windows 11 Pro from $15.58

November 9, 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