CyberTower/scripts/enemy.gd
2024-02-16 23:35:39 +08:00

20 lines
279 B
GDScript

class_name Enemy
extends CharacterBody2D
signal enemy_defeat
@export var damage = 8.0
@export var max_health = 20
var health: float
func _ready():
health = max_health
func take_damage(amount: float):
health -= amount
if health <= 0:
enemy_defeat.emit()
queue_free()