How to Make a Health Bar in Godot 4 | tutorial | GDScript

preview_player
Показать описание
Health Bars are super common in a lot of games, and after I made the tutorial on player health using hearts, I've been asked a bunch of times to make one about health bars.

So here it is.

In this tutorial I will show you two useful Godot nodes for creating health bars.
You can also use them for other types of progress bars.
Like showing the duration of a spell cast.

00:00 intro
00:43 setup
01:20 Progress Bar
02:34 Script
04:26 TextureProgressBar
06:26 NinePatchRect
07:00 Other options
07:27 Thank you

---------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------

#gamedev #godot #godotengine #godot4 #tutorial #zeldalike #learntocode #howtomakeagame
Рекомендации по теме
Комментарии
Автор

I'm glad to see the new video, your game is looking better and better!

korand
Автор

this is so helpful, even though i have a working health bar for my game study. seeing simpler approach like this is so good.

hellblazer
Автор

Ahh a bit of a sneaky assignment-implied ending there 😜where many of us would love the peek at how you attach these bars to the slime, and how we get the slime to take damage from the sword rather than just poof from one hit. I'm sure it will be a fun time to figure these out, but I will sorely miss the tutorials now that I've done all the RPG and this one. All fantastic, and so grateful, hope to see more soon!

AaronBeyer
Автор

Please a dialogue system now, It would be great to speak to NPC's to get some item or something like that. Great video, thank you for your amazing work!

estebangeorgenunezmoran
Автор

This was really helpful. Thanks for sharing.

DavidReidChannel
Автор

That's amazing it helped me a ton! Thx!

dominikstandardowy
Автор

Hey! You didn’t say “Hi everyone!” Lol. Great tutorial yet again.

_xtel
Автор

Super late but if the progress bar is not visible on your screen then it's because it is not placed in the blue square in the UI. Try to follow the red and the green lines where they cross and it shoulb be in the bottom left of it

tiredhades
Автор

I agree id like to see how to equip the sword when picked up an when youre love on hearts you can use a lifepot to regain hearts

ericwood
Автор

i love this series! do you plan on making a video that demonstrates how to use the items in your inventory soon?

fridaymove
Автор

Increíble video, me pareció super interesante!!

Gaztyyy
Автор

Great video! God bless y'all❤ owo

thegamesirege
Автор

My progressbar is not visible on the same tree as player, I have it in the UI scene, when I try to assign the @onready var player: Player, there is nothing to select. Do I have to change it up or is there a workaround? Thanks in advance for help!

Antonovka
Автор

In the progress bar script, at the top it says:
@export var player: Player

Does that mean the player has the class name "Player" and it is connecting to that class name?

ReillyWebster
Автор

My health bar minimum value starts at 5 and max value is 64. I'm trying to align it properly to make it start from 0 to 100 but nothing seems to be working. Any ideas?

player_two
Автор

Having a bug where it will load with the health value but not update when taking damage dispute the health changed checker being in my take damage func
(edit: fixed it)

izzytehwolf
Автор

My healthbar (TextureProgressBar) is empty when I start the game. The progress is only correct when the player is hit by an enemy.
I have not yet found a bug in the script. 🙁
Edit: Do I need something like preload?

meddlin
Автор

Hi great tutorial, but i'm having a problem when i die, my bar doesn't reset to it's original position. When i call a method where use queue free + a reload scene.

mozarv
Автор

hi, why doesn't my health bar change? have I missed something? The command text below shows the health bar decreasing but the health bar graph doesn't change :(

FryanRyan
Автор

please make a tutorial how to drag and drop

Osotogari