I'm trying to make my enemies spawn, and then follow and look at the player- but for some reason get_position() is returning 0,0, i'm assuming it's accessing that from the player scene itself, but I'm not sure. I've been googling for hours and Im stumped, 'll reply with a video of the problem as well.
class_name enemy
var current_pos
@export var speed = 100
var screen_size
var player_pos
func _ready():
player_pos = get_node(":/root/main/player").get_position()
screen_size = get_viewport_rect().size
func _physics_process(float) -> void:
current_pos = player_pos
look_at(current_pos)
velocity = (current_pos - position).normalized() * speed
move_and_slide()
position = position.clamp(Vector2.ZERO, screen_size)
func _process(float) -> void:
print(current_pos)```