# Leading Shots (Turret Defence Game)

**URL:** <https://forum.kirupa.com/t/leading-shots-turret-defence-game/294018>\
**Category:** Uncategorized\
**Created:** [August 7, 2009, 12:47am UTC](https://forum.kirupa.com/t/leading-shots-turret-defence-game/294018 "2009-08-07T00:47:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kramcomposer](https://avatars.discourse-cdn.com/v4/letter/k/8edcca/32.png) [@kramcomposer](https://forum.kirupa.com/u/kramcomposer)\
**Post date:** [August 7, 2009, 12:47am UTC](https://forum.kirupa.com/t/leading-shots-turret-defence-game/294018/1 "2009-08-07T00:47:33Z")

</div>

Hi I am facing a problem with my turrets not hitting targets  
So basically I need my turrest to lead thier shots.

So far I figured out basicly

```auto

time =(distance from turret to current enemy position)/(bullet speed)
predictedX = currentX+speedX*time
predictedY = currentY+speedY*time 			 		

```

Well the problem is, that with slower projectiles, its very inaccurate because the time for the projectile to reach the predicted location is different than the initial distance;time calculation

any suggestions?
