Frontier-of-Hell/scripts/enemies/enemy-1.gd
2023-10-06 16:40:11 +07:00

19 lines
322 B
GDScript

extends CharacterBody2D
@export var health : int = 100
func _process(delta):
update_healthbar()
if health <= 0:
queue_free()
func update_healthbar():
$HealthBar.value = health
if health >= 100:
$HealthBar.visible = false
else:
$HealthBar.visible = true
func hit(damage : int):
health = health - damage