What do you mean by "spit cores"? Is that a projectile weapon?
And what do you mean by it being everytime different?
If you want the enemy to shoot a projectile in link's direction, then use point_direction(link.x,linky.y,x,y) and set the direction of the projectile to the value of the point_direction function.