I am creating a tower defense game where the enemies shoot back at the turrets. I have spent multiple hours and tried multiple setups of code and none will perform the desired task. I have used the "pick nearest" command to target a box, and the box is always fixed on a turret. However, when the turret is destroyed (along with the box), the enemies fire at the second placed turret instead of the next CLOSEST turret. I can't find where I'm going wrong. If anyone has the time to look at this and lend advice I'd greatly appreciate it.
The specific lines of code are at the bottom of the L1-1 Event Sheet.
Here is the capx:
If you run the layout, click the texts on the right to spawn a turret and the other icons are self explanatory.
Thanks to anyone who has the time.