2023-10-10 19:38:24 -04:00
|
|
|
extends Control
|
|
|
|
|
|
|
|
@onready var healthBar : ProgressBar = $HealthBar
|
|
|
|
@onready var hpLabel : Label = $HealthBar/HP
|
2023-10-10 20:26:50 -04:00
|
|
|
@onready var timer : Timer = $Timer
|
2023-10-10 19:38:24 -04:00
|
|
|
|
|
|
|
func setHP(currentHp, maxHp):
|
|
|
|
healthBar.min_value = 0
|
|
|
|
healthBar.max_value = maxHp
|
|
|
|
healthBar.value = currentHp
|
|
|
|
hpLabel.text = str(currentHp) + "/" + str(maxHp)
|
2023-10-10 20:26:50 -04:00
|
|
|
timer.start()
|
|
|
|
visible = true
|
|
|
|
|
|
|
|
|
|
|
|
func _on_timer_timeout():
|
|
|
|
visible = false
|