enabled enforced static typing
This commit is contained in:
@ -1,22 +1,21 @@
|
||||
extends Node
|
||||
class_name Health
|
||||
class_name Health extends Node
|
||||
|
||||
signal health_depleted
|
||||
signal health_changed(health)
|
||||
signal health_changed(health: int)
|
||||
|
||||
@export var damage_particle_scene : PackedScene
|
||||
@export var damage_particle_scene: PackedScene
|
||||
@export var max_health: int = 10
|
||||
|
||||
@export var max_health := 10
|
||||
var current_health
|
||||
var current_health: int
|
||||
|
||||
func take_damage(damage):
|
||||
func take_damage(damage: int) -> void:
|
||||
current_health -= damage
|
||||
health_changed.emit(current_health)
|
||||
if current_health <= 0:
|
||||
health_depleted.emit()
|
||||
|
||||
|
||||
func heal_damage(healing):
|
||||
func heal_damage(healing: int) -> void:
|
||||
current_health += healing
|
||||
if current_health > max_health:
|
||||
current_health = max_health
|
||||
|
Reference in New Issue
Block a user