Auto-Turret Woes

0 favourites
  • 3 posts
From the Asset Store
10 turrets rendered in 3D with top down and menu views. Three upgrade levels per tower.
  • Hello all,

    I have yet another problem that I have run into and am having trouble with.

    For my game I created an auto-turret. What I want it to do basically is pick the nearest enemy (there are multiple enemy types, so I chose the family as the target which contains all enemies), rotate towards it and if it is within a certain distance (say, 700 pixles) then it will fire at the enemy.

    I can get this to half work, basically. It will sometimes target an enemy and shoot at it, but it will often ignore the closest enemy, and once it 'targets' an enemy, it will always rotate towards it even if there are closer targets at hand until the target it was fixated on is dead, and then it will go and kill a couple of other monsters and then it will just stop targeting anything for awhile (it seems to come and go in spurts).

    Here is what the events look like at the moment. Maybe I am just sleep deprived but I can't tell where I went wrong. Any help/advice is greatly appreciated. Thank you!

    <img src="" border="0" />

  • I believe it's because you're picking the closest AutoTurret to a monster for each Autoturret.

    Change both instances to Monsters > Pick nearest to (AutoTurret.X,AutoTurret.Y)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • That did the trick. Thank you very much!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)