feat: player health status updates HUD
This commit is contained in:
parent
7b231bd0f3
commit
943325ce4b
|
@ -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"]
|
||||||
|
|
Loading…
Reference in a new issue