I need the actor("enemy"), that when I move away from him and he can no longer attack me, that he change his image, instead of the one he used to attack me.
I would greatly appreciate the help! :D.
To determine if something moves away from you, you need to calculate the distance between you and that object (pythagoras) and then compare it to a value computed in the previous frame. If the new value is smaller, you are living towards that object, if it’s greater, away from it. If it is identical, you didn’t move (relative to each other). Finally save the computed value as the last computed value for the next frame