spawnable tests and hpbar for bebittes
This commit is contained in:
@@ -2,9 +2,16 @@ extends Control
|
||||
|
||||
@onready var healthBar : ProgressBar = $HealthBar
|
||||
@onready var hpLabel : Label = $HealthBar/HP
|
||||
@onready var timer : Timer = $Timer
|
||||
|
||||
func setHP(currentHp, maxHp):
|
||||
healthBar.min_value = 0
|
||||
healthBar.max_value = maxHp
|
||||
healthBar.value = currentHp
|
||||
hpLabel.text = str(currentHp) + "/" + str(maxHp)
|
||||
timer.start()
|
||||
visible = true
|
||||
|
||||
|
||||
func _on_timer_timeout():
|
||||
visible = false
|
||||
|
@@ -1,6 +1,7 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://fojbwshce7ah"]
|
||||
[gd_scene load_steps=3 format=3 uid="uid://fojbwshce7ah"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scenes/Spawnables/UI/SpawnableUI.gd" id="1_en1j6"]
|
||||
[ext_resource type="Theme" uid="uid://dr1h7to56a2pv" path="res://Themes/base_theme.tres" id="2_ouwgg"]
|
||||
|
||||
[node name="SpawnableUI" type="Control"]
|
||||
layout_mode = 3
|
||||
@@ -18,6 +19,7 @@ anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme = ExtResource("2_ouwgg")
|
||||
min_value = 100.0
|
||||
step = 1.0
|
||||
value = 100.0
|
||||
@@ -36,7 +38,11 @@ offset_right = 15.5
|
||||
offset_bottom = 7.5
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
theme_override_font_sizes/font_size = 8
|
||||
text = "100/100"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
one_shot = true
|
||||
|
||||
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]
|
||||
|
Reference in New Issue
Block a user