Health meter
This commit is contained in:
parent
edadd138b0
commit
0f5e075a54
4 changed files with 47 additions and 10 deletions
|
@ -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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue