Click & Drag towers to move them
Electricity should pierce through multiple enemies before it stops. It will aim for the furthest along enemy that is also close by (so it can arc across to a different part of the track and can arc to enemies that weren't inside its tower's range).
Each tower has a range of 200 pixels (that's the radius of its range circle) and it will target the enemy that is both within its range and is furthest along the path.
If performance is a concern there are a few optimizations that could be made:
- Make the enemies send all their info to the brain object, then have the towers request it from the brain and the brain reply with the info. This reduces the amount of messages sent from (the amount of towers)x(the amount of enemies) instead down to (the amount of towers)+(the amount of enemies)