![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | KiraArts |
Hello.
im trying to make a hp bar with textureprogress (for a rpg game), but in the script, when i try to change the “value” and “max_value” irecive this error: Invalid get index “maxvalue” (on base “texturepogress”) with value of typi “Nil”.
so I think I can solve it by changing the type of the variable, but i dont know how.
Code:
onready var vida_bar = $evilbar #textureprogress
onready var malovida = $evillife
var life
signal win
func _ready():
_on_grid_hpevil(life)
func _on_grid_atack(damage):
life = life - damage
evillife.text = String(life)
update_hpbar()
if life <= 0:
emit_signal("win")
func _on_grid_hpevil(hp):
life = hp
life_bar.value = hp
life_bar.max_value = hp
func update_hpbar():
vida_bar.value = vidamalo