Need Advice on multiple turrets shooting units
Im fairly behind on all that "action stuff" in MMF2, spend lot's of time on strategy and RPG, so I need some advice on how to do that.
So in my game at runtime you can place multiple turrets of different kinds.
Take this as an example (thats not my game just a screenshot)
http://fudder.de/uploads/tx_nidagnew...20070611td.jpg
There are two ways I know of I would prefer the first one, but the second one will do as well.
First method.
Every Second each of those turrets calculate the distance to all enemy targets. All targets are IDed and I want each turret to store the one ID that is closed (compared in distance) to him. How do i pick the object that is closest to a turret?
Second method.
Each turret has a "Range" Detector overlay, an active actually and I check for overlapping. Once overlapping I want only that one turret to shoot at the enemy. If there are more then two overlapping a random pick would be ok or the first one gets shot until dead.
Any ideas, maybe other ideas as well?
I had an old example for the value finder extension. Unfortunatly it's not 2.0 compatible :(
Re: Need Advice on multiple turrets shooting units
I uploaded an example:
http://www.fromheaven.de/Turrets.mfa
I run a loop for each turret which starts a second loop for each enemy. On the second loop it checks the distance and writes it to the turrets alt value. I made a second condition which checks if that distance is actually the lowest one and if that is true write it into another alt value. However that part is not working. Any help appreciated :)
Re: Need Advice on multiple turrets shooting units
I think this will help a little. Its an example I posted a while ago on how to make multiple turrets shoot different targets depending on the closest one.
http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Main=6951&Number=46515 #Post46515
Re: Need Advice on multiple turrets shooting units
Thanks Brandon, I will give it a try.