Compare commits

...

3 commits

Author SHA1 Message Date
Sara 943325ce4b feat: player health status updates HUD 2025-08-31 14:07:16 +02:00
Sara 7b231bd0f3 feat: adjusted healthbar 2025-08-31 14:04:02 +02:00
Sara 36443b1790 feat: adjusted Health bar in hud 2025-08-31 13:53:45 +02:00
2 changed files with 9 additions and 3 deletions

View file

@ -63,12 +63,11 @@ layout_mode = 1
anchors_preset = 2 anchors_preset = 2
anchor_top = 1.0 anchor_top = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
offset_top = -37.0 offset_top = -76.0
offset_right = 280.0 offset_right = 411.0
grow_vertical = 0 grow_vertical = 0
theme_override_styles/background = SubResource("StyleBoxFlat_sbqmm") theme_override_styles/background = SubResource("StyleBoxFlat_sbqmm")
theme_override_styles/fill = SubResource("StyleBoxFlat_hsy36") theme_override_styles/fill = SubResource("StyleBoxFlat_hsy36")
max_value = 1.0 max_value = 1.0
value = 1.0 value = 1.0
rounded = true
show_percentage = false show_percentage = false

View file

@ -10,6 +10,12 @@ script/source = "extends HealthStatus
func _on_death() -> void: func _on_death() -> void:
get_tree().change_scene_to_file.call_deferred(\"res://guis/main_menu.tscn\") get_tree().change_scene_to_file.call_deferred(\"res://guis/main_menu.tscn\")
func _on_health_changed(remaining: int, _delta: int) -> void:
var hud := HeadsUpDisplay.get_singleton()
if hud:
hud.set_health_percentage(float(remaining) / float(self.get_max_health()))
" "
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_bxedw"] [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_bxedw"]
@ -61,3 +67,4 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
shape = SubResource("CapsuleShape3D_eqqp1") shape = SubResource("CapsuleShape3D_eqqp1")
[connection signal="death" from="HealthStatus" to="HealthStatus" method="_on_death"] [connection signal="death" from="HealthStatus" to="HealthStatus" method="_on_death"]
[connection signal="health_changed" from="HealthStatus" to="HealthStatus" method="_on_health_changed"]