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

AnonyViet by AnonyViet
February 2, 2023
in Tips
0

Continuing with the enemy, in this article we will create hp for the enemy and this article is quite short, in the next post I will guide you to create slash animation (because anonyviet’s available assets do not have slash animation, so I will get animation. and if you use another asset that has an animation attack, use it) and kill the enemy.

Join the channel Telegram of the AnonyViet 👉 Link 👈

USE EXPORT

Go to the script enemy and then you declare your HP variable

I will declare as:

export var hp = 2

use export declare variable HP

And Export here is the declaration command that takes the value out of the table Properties to edit

Properties panel to edit

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

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

And you can apply it to many other things

Here I will show you a trick to choose something like color etc

Color change code

Export(String,”text”) var tenbien 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)

What color is the if statement to compare?

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

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

You can func create a function that contains the command to change the color and then call the function to change the color in physic or process

Examples are as follows:

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

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

Tags: createEnemyEngineGameGodotlậpLessontrình
Previous Post

How to write Game with Game Maker Studio 2

Next Post

Download 5KPlayer – Movie player software that supports many new features

AnonyViet

AnonyViet

Related Posts

Share Tut Set Set Camp to get more comments with Facebook Ads
Tips

Share Tut Set Set Camp to get more comments with Facebook Ads

September 30, 2025
[Update] How to receive Google Ai pro 1 year free with telegram
Tips

[Update] How to receive Google Ai pro 1 year free with telegram

September 29, 2025
How to save photos of friends to overcome Facebook images
Tips

How to save photos of friends to overcome Facebook images

September 29, 2025
Copy all Google Drive others about Google Drive
Tips

Copy all Google Drive others about Google Drive

September 28, 2025
Summarize 8+ orders to create Mid -Autumn Festival for women
Tips

Summarize 8+ orders to create Mid -Autumn Festival for women

September 27, 2025
How to create a portrait of business entrepreneurs
Tips

How to create a portrait of business entrepreneurs

September 27, 2025
Next Post
Download 5KPlayer – Movie player software that supports many new features

Download 5KPlayer - Movie player software that supports many new features

0 0 votes
Article Rating
Subscribe
Login
Notify of
guest

guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Recent News

Share Tut Set Set Camp to get more comments with Facebook Ads

Share Tut Set Set Camp to get more comments with Facebook Ads

September 30, 2025
[Update] How to receive Google Ai pro 1 year free with telegram

[Update] How to receive Google Ai pro 1 year free with telegram

September 29, 2025
Top 10 good quality camera memory cards should be used

Top 10 good quality camera memory cards should be used

September 29, 2025
How to block ads on iPhone, iPad and Mac (both web and app)

How to block ads on iPhone, iPad and Mac (both web and app)

September 29, 2025
Share Tut Set Set Camp to get more comments with Facebook Ads

Share Tut Set Set Camp to get more comments with Facebook Ads

September 30, 2025
[Update] How to receive Google Ai pro 1 year free with telegram

[Update] How to receive Google Ai pro 1 year free with telegram

September 29, 2025
Top 10 good quality camera memory cards should be used

Top 10 good quality camera memory cards should be used

September 29, 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

Share Tut Set Set Camp to get more comments with Facebook Ads

Share Tut Set Set Camp to get more comments with Facebook Ads

September 30, 2025
[Update] How to receive Google Ai pro 1 year free with telegram

[Update] How to receive Google Ai pro 1 year free with telegram

September 29, 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í 8XBET https://kubet88.yoga/

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í 8XBET https://kubet88.yoga/

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