18 lines
308 B
GDScript3
Raw Normal View History

2024-01-18 22:35:17 +00:00
class_name EnemyController
2024-02-07 22:04:19 +00:00
extends Controller
2024-02-13 10:56:04 +00:00
var enemy: Enemy
2024-02-15 15:28:27 +00:00
func _init():
name = "Controller"
2024-02-13 10:56:04 +00:00
func _ready():
enemy = owner
func _process(_delta):
2024-02-19 15:03:08 +00:00
if !Global.player:
return
2024-02-13 10:56:04 +00:00
var direction := (Global.player.global_position - enemy.global_position).normalized()
2024-02-15 15:28:27 +00:00
direction_changed.emit(direction)