I have made an enemy follow the player with:
var health = 60
onready var player = get_node("/root/Node2D/KinematicBody2D")
var speed = 60
var velocity = Vector2()
func _physics_process(delta):
velocity = position.direction_to(player.position) * speed
velocity = move_and_slide(velocity)
It works but when the enemy reaches the player (I haven't implemented collision yet) it will judder non stop. I tried to implement something where if the enemy's position is the player's position it will stop, but this doesn't seem to do anything.