if distance_to_object(objchara_link.x)<4
Nerp, that function calls for an object's name, not one of its variables.
Here's what I'd suggest:
var dir;
dir=point_direction(x,y,objLink.x,objLink.y)
if distance_to_object(objLink)<16 {
if dir>=315 || dir<45 {
sprite_index=(attacking right)
} else if dir>=45 && dir<135 {
sprite_index=(attacking up)
} else if dir>=135 && dir<225 {
sprite_index=(attacking left)
} else {
sprite_index=(attacking down)
}
} else {
sprite_index=(not attacking)
}
First that makes a new variable called dir, which is the angle from the Deku Baba to Link (0 to 360 degrees).
If the Link object is within 16 pixels (you might even want to make that higher, like around 40), then check which range the angle falls into, and set the corresponding sprite.