mirror of
https://gitlab.com/open-fpsz/open-fpsz.git
synced 2026-07-16 00:44:50 +00:00
✨ Various improvements to the demo game mode
This commit is contained in:
parent
c16a71ca74
commit
638117c8f5
9 changed files with 57 additions and 41 deletions
|
|
@ -11,13 +11,16 @@ func _ready():
|
|||
area_entered.connect(_on_area_entered)
|
||||
|
||||
func damage(amount : int):
|
||||
health -= amount
|
||||
if health <= 0:
|
||||
health = clampf(health - amount, 0.0, max_health)
|
||||
if health == 0.0:
|
||||
health_zeroed.emit()
|
||||
|
||||
func reset():
|
||||
func heal_full():
|
||||
health = max_health
|
||||
|
||||
func _on_area_entered(area):
|
||||
func heal(amount : int):
|
||||
health = clampf(health + amount, 0.0, max_health)
|
||||
|
||||
func _on_area_entered(area : Area3D):
|
||||
if area is AreaDamageComponent:
|
||||
damage(area.damage)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue