# Making enemies fire when player is in range

**URL:** <https://forum.kirupa.com/t/making-enemies-fire-when-player-is-in-range/88699>\
**Category:** Uncategorized\
**Created:** [May 1, 2005, 11:03pm UTC](https://forum.kirupa.com/t/making-enemies-fire-when-player-is-in-range/88699 "2005-05-01T23:03:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rsugar](https://avatars.discourse-cdn.com/v4/letter/r/8baadc/32.png) [@rsugar](https://forum.kirupa.com/u/rsugar)\
**Post date:** [May 1, 2005, 11:03pm UTC](https://forum.kirupa.com/t/making-enemies-fire-when-player-is-in-range/88699/1 "2005-05-01T23:03:01Z")

</div>

I cant find any tutorials anywhere that show how to find distance to an object.  
ex. i want a “turret” or “tank” to not fire until my"helicopter" is in range"  
im in 8th grade and my school doesnt offer trig… :(.  
could someone please give me an example or a piece of code and explain it to me?  
thnx
