# having something being in range!

Member, BASIC Posts: 639

okay so kinda vague i know, but i would like to have my enemies attack the closer the hero actor is to them with both the x and y positions... picture there being a circle around an enemy actor and when that "circle" is touched thats when the enemy activates and starts attacking... hope that makes sense lol

• London, UK.Member Posts: 12,822
edited June 2016

Use magnitude to detect the distance between two actors.

Or place a circle actor (invisible with collision set to circle) around the NMEs and use a basic collision rule to detect when the hero has overlapped the circle.

• ImagineLabs.rocks Member, BASIC Posts: 5,657

Here is a tutorial on the Magnitude Function if you want to check it out:

• Member, BASIC Posts: 639

wow thanks so much you all!!!!! xoxoxoxo! ill check this out Jamie!

• NetherlandsMember Posts: 285

@jamie_c Nice video! What happens hen you have 4 actors who are approaching the shooting actor at the same time? Is the shooting actor just going to shoot on the actor that is the closest and is this heavy on performance?