it depends how you control your character but you can get the normal between the two sprites and set the movement of the running away sprite by multiplying -speed on the X and Y normal of the running away sprite if you want that'S super simple
if you wanna do some weird stuff, you can like pathfind the running away sprite in that direction with another sprite to test for collision and if that other sprite finds collision you move it further away until it is placeable and then pathfind to there with the running away sprite so your running away sprite could move around obstacles