You should do a circle collision check around the player and then spawn enemies,When I am at the top of the screen enemies don't appear on the screen they spawn and hit me and I take damage.
If that happens again would be helpful if you copy what that error says and paste it here. I do know about the enemies spawning too close to the player and there is a small "dead" zone where they cant spawn but i guess its so small that it doesnt make that much of a difference. Thanks for playing at least.