18 lines
315 B
GDScript
18 lines
315 B
GDScript
class_name EnemyController
|
|
extends Controller
|
|
|
|
var enemy: Enemy
|
|
|
|
func _init():
|
|
name = "Controller"
|
|
|
|
func _ready():
|
|
enemy = owner
|
|
|
|
func _process(_delta: float):
|
|
if !Global.player:
|
|
return
|
|
|
|
var direction := (Global.player.global_position - enemy.global_position).normalized()
|
|
direction_changed.emit(direction)
|