I've used Godot's Light 2d node in mask mode to hide the enemies when they exit player's field of view. Hope it can be useful to you :)
(also you can't really escape, the levels loop indefinitely )