oh yeah and here's my code, almost forgot to place it
extends KinematicBody2D
var speed = 300
var velocity = Vector2.ZERO
onready var enemy = get_parent()
var player = null
var attack_range = 350
func _on_Area2D_body_entered(_body):
player = _body
func _on_Area2D_body_exited(_body):
player = null
func _physics_process(_delta):
if player.global_position.x and player.global_position.y > attack_range:
var velocity = (player.position - position).normalized() * speed
move_and_slide(velocity)
(that var velocity in the physics process is a failed attempt at solving it)