Shoot, it's not formatting right. Here's what I meant:
func _ready() -> void:
if get_node("Player").position.x < get_node("Enemy").position.x:
_velocity.x = -speed.x
else:
_velocity.x = speed.x
You can do something like that, but there are some things to consider with your code's structure:
First, if I understand your problem correctly, you want the enemy to move in the player's direction first when loading the level, but you don't want the enemy to pursue the player.
To do so, I would recommend to:
I'll record a short video to show you how and post it here.
There you go! Your answer in video: https://gdquest.mavenseed.com/lessons/making-the-enemy-move-towards-the-player-at-the-start