add health component and FollowTarget Enemy Controller and minor changes
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
class_name FollowTargetEnemyController extends SimpleEnemycontroller
|
||||
|
||||
@export var target:Node2D
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
super._ready()
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
if target:
|
||||
direction = sign(target.global_position.x - body.global_position.x )
|
||||
else:
|
||||
direction = 0
|
||||
|
||||
super._process(delta)
|
||||
Reference in New Issue
Block a user