Godot Version
4.4
Question
how do i make the progress texture update when i am dealt damage
Do you wanna change the texture?
Can you say more specifically
Hey, you can update the TextureProgress bar by changing its value whenever damage is taken, like this: $HealthBar.value, damage amount. Just make sure the min_value and max_value are set correctly. That should make the texture update to reflect the current health.
Ohh that’s very easy you can use this code
#Player script
func _process(delta):
$path_of_your_texture.value = health #your players health
#you can drag your progress texture node into the script
so i just put this on the player code and then i get tree of the ui code?
Yes your tree should look like
Player
-----Hp
----------margincontainer
------------------------textureprogressbar
its giving me a problem
yeah i did this, but my game is 3d so maybe that is the problem? or maybe is the way i calculate hp?
Can you share a screenshot of your code?
Ohh there’s the problem it should be @export not @onready
Like this
@export var health:int = max_health
It says node not found it should be
$Hp/MarginContainer/TextureProgressBar
Just copy it and paste it
You’re welcome:D
That looks sick btw !