Health meter

This commit is contained in:
Felipe M 2021-02-04 20:04:56 +01:00
parent edadd138b0
commit 0f5e075a54
Signed by: fmartingr
GPG key ID: 716BC147715E716F
4 changed files with 47 additions and 10 deletions

View file

@ -4,6 +4,7 @@ class_name PlayerStats
var max_health = 4
var health = max_health setget set_health
signal player_health_changed(value)
signal player_died
func set_health(value):
@ -11,6 +12,7 @@ func set_health(value):
Events.emit_signal("add_screenshake", 0.5, 0.5)
health = clamp(value, 0, max_health)
emit_signal("player_health_changed", health)
if health == 0:
emit_signal("player_died")