I tried your example. So, I understand your project a little better. I don’t know why the turret is only targeting 1 side. I tried it on my phone, so I didn’t get the full picture.
I made a tower defense example awhile ago. The playable link is broken but the project is still in my github account. It uses a similar concept. I’m hoping some of this long, long post will help.
https://forum.gdevelop.io/t/how-to-target-first-enemy-in-td-game/44837/7?u=keith_1357
Here’s my technique. It won’t all apply to your project. Im writing this from my memory. So, I’m not positive thaty project used this exact technique.
Each bullet is linked to a target. The fire bullet extension doesn’t automatically pick the fired bullet. You can add a bullet object manually and then add force. There’s another work around using a boolean object variable.
My example was more a cannon than a gun. So, I used a tween to move the bullet to the location instead of the fire extension. When the tween finished it basically meant the bullet hit the ground or target, it then checked for a collision between the bullet and enemies. That way the bullet could pass through other enemies. Remember, mine was more of a cannon. So, it fired over the objects. This might not apply to your project.
I used the health extension but I also used a variable as a sort of health preview should all of the bullets hit it. Every time a bullet was fired at it, the health variable was decreased. That way, it could target only enemies whose predicted health variable was above 0.
Now, since my enemies moved, the bullet could miss the intended target. That’s where the linking came into play.
When the bullet exploded, if it didn’t hit the indeed target, the linked object’s health variable value was increase. I don’t recall my method. It’s in the project.
It seems less likely that a target would be missed in your project. It might be enough to skip the linking and just use an object variable to preview the damage.
Take a look at my project and see if any of my concept applies to your project.
Alternatively, you could give the enemies an ID variable and add an ID to the bullet. Then only a bullet with a matching ID could damage an enemy. Just keep increasing the ID. That would allow the turrets to target any object not just the closest. It could shoot 3 bullets at the first object and the shoot 3 at the next closest.
Example
Enemy predictiveHealth variable > 0
Pick nearest enemy
Fire bullet at enemy
Decrease the enemy health variable
Link or use IDs if applicable
If bullet collides with enemy
If bullet ID = enemy ID
Apply damage
Delete bullet
If it was possible for a bullet to miss it’s target then you would need to remove the damage from the predicted health variable.
I hope there’s something in this long post that helps.