In this code you are instancing enemy every frame this will lead to memory leaks because they wont be freed by themselves.
var enemyscene = load("res://Scenes/VirusBlue.tscn")
var enemy = enemyscene.instance()
var obj = get_tree().get_nodes_in_group("Viruses")
you are doing it wrong
1.) you are loading enemy scene every frame. (performance heavy)
2.) you are making instance of enemy and not using addchild or queuefree . (memory leak)
Then in this function , it may take lot of time depending on your luck to get position and it may result in hangs.
var x = rand.randf_range(0, screen_size.x)
var y = rand.randf_range(0, screen_size.y)
var newLoc = Vector2(x,y)
var tooClose = false
for loc in spawnLocs:
if newLoc.distance_to(loc) < minDist:
tooClose = true;