• 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.

HP code

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

How to view web access history in the anonymous mode (Incognito) of Chrome
Tips

How to view web access history in the anonymous mode (Incognito) of Chrome

August 22, 2025
How to graft the peach branch based on electric poles, family cycling, uncle
Tips

How to graft the peach branch based on electric poles, family cycling, uncle

August 21, 2025
Unlock checkpoint 72h often have photos already but hang nick
Tips

Unlock checkpoint 72h often have photos already but hang nick

August 19, 2025
GIF image creation tips with high quality snipping tool
Tips

GIF image creation tips with high quality snipping tool

August 19, 2025
How to unlock Facebook to download your latest photos
Tips

How to unlock Facebook to download your latest photos

August 18, 2025
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
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
Inline Feedbacks
View all comments

Recent News

Đá Gà Online Sonclub Đỉnh Cao Giải Trí 2025

August 22, 2025
How to view web access history in the anonymous mode (Incognito) of Chrome

How to view web access history in the anonymous mode (Incognito) of Chrome

August 22, 2025
How to automatically erase the web history after escaping to absolutely secure

How to automatically erase the web history after escaping to absolutely secure

August 22, 2025
Stainless steel flange price list at Asia Industry

Stainless steel flange price list at Asia Industry

August 21, 2025

Đá Gà Online Sonclub Đỉnh Cao Giải Trí 2025

August 22, 2025
How to view web access history in the anonymous mode (Incognito) of Chrome

How to view web access history in the anonymous mode (Incognito) of Chrome

August 22, 2025
How to automatically erase the web history after escaping to absolutely secure

How to automatically erase the web history after escaping to absolutely secure

August 22, 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

Đá Gà Online Sonclub Đỉnh Cao Giải Trí 2025

August 22, 2025
How to view web access history in the anonymous mode (Incognito) of Chrome

How to view web access history in the anonymous mode (Incognito) of Chrome

August 22, 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