How can I make the ogre attack me when it is near my character?

Hello everyone, how are you? How can I make the ogre attack me when it is near my character? I would like it not to react at a distance of 200 pixels, staying still. When it’s closer than 200 pixels, it would come towards me with the walking animation, but when it gets really close, around 25 pixels, it would attack me, using the attack animation, of course. If I move away, the animations would return to normal.

I would be very happy if someone could help me, as I couldn’t get this system to work. Thank you!

You can right click condition and choose invert

And you do not check if something is either below or above some pixels value of distance

You check range

SO
Condition
Enemy distance to player is below 200
INVERTED Enemy distance to player is below 25

Action
Here you move enemy toward player and change enemy animation

Another event
Condition
Enemy distance to player is below 25

Action
Here you change enemy animation to attack

And that is pretty much it

Inverted distance check condition is not checking if distance is below said value but if its ABOVE

That’s why 1st event i mentioned checks range instead of one or other way
So it checks if distance from enemy to player is between 25 to 200 pixels
Anything beyond or below this range and event won’t work and that is exactly what you want

1 Like

Thanks a lot. I’ll give it a shot and let you know how it goes