ft: improved npc spawning logic
This commit is contained in:
@@ -4,6 +4,8 @@ class_name NPC2D
|
||||
@export var maxHealth: int = 0
|
||||
var health: int = maxHealth
|
||||
|
||||
signal died
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
spawn()
|
||||
@@ -30,6 +32,7 @@ func feed(source ) -> void:
|
||||
push_error("Function feed() not implemented.")
|
||||
|
||||
func die() -> void:
|
||||
died.emit()
|
||||
queue_free()
|
||||
# TODO: should associate this class with a loot table (or equivalent), and can then implement logic for dying in parent class here.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user