Auto-Turret Woes

Get help using Construct 2

Post » Wed Jul 04, 2012 6:27 am

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!

B
19
S
6
G
5
Posts: 98
Reputation: 4,484

Post » Wed Jul 04, 2012 9:33 am

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)
B
9
S
2
G
3
Posts: 75
Reputation: 1,964

Post » Wed Jul 04, 2012 5:41 pm

That did the trick. Thank you very much!
B
19
S
6
G
5
Posts: 98
Reputation: 4,484


Return to How do I....?

Who is online

Users browsing this forum: anty21ro, Braus and 2 guests