17 lines
236 B
GDScript3
17 lines
236 B
GDScript3
|
class_name Enemy
|
||
|
|
||
|
extends CharacterBody2D
|
||
|
|
||
|
@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:
|
||
|
queue_free()
|