Hypozonic
well, I played around with your game quite a bit, and made lots of changes... and there are still a lot of things I would do differently, but I have other things I should be working on :)
to make the enemies not target food outside the layout, you have to make sure it is out of range, or better yet, destroy all food at the beginning of the game (Start of Layout) - before new food starts to randomly generate.
I made the mouse wheel zoom in and out of the layout so that I could check up on all the enemies...
I made the enemies bump apart if they run into each other, and look for new food.
I also tried a alternative method to find food for the dark enemies (using a "detector" sprite instead of line of sight. That lets you select whatever food is near the enemy and then choose the closest.
For some reason the path finding sometimes just fails to find a path, so in the dark enemy section I have it just randomly put the enemy somewhere else and try again...
Now, the only time I have seen an enemy get stuck is if it is trying to get to a food near the edge of the screen but can't quite get there. (You can click on an enemy and the food it is going for will flash).
I made the dark enemies grow much faster than you had them, just to speed up debugging...
you can download my version of your game here:
https://www.rieperts.com/games/forum/agar_tester2.c3p