I'm not sure how to assign a number to an enemy, and refer to it using the numbers generated by an array. For instance, if the array generates a 1, 2, and 3, I want to spawn one enemy with the assigned number 1, another with the number 2, and another with 3.
Here's the code for choosing a random enemy (I know it's bad, I'm still new to RNG):
var Spitter = preload("res://Spitter.tscn").instance()
var Zombie = preload("res://Zombie.tscn").instance()
var Hunter = preload("res://Hunter.tscn").instance()
var enemyarray = [Zombie, Hunter, Spitter]
var randomenemy = enemyarray[randi() % enemyarray.size()]
var randomenemy2 = enemyarray[randi() % enemyarray.size()]
var randomenemy3 = enemyarray[randi() % enemyarray.size()]
parentnode.calldeferred("addchild", randomenemy)
parentnode.calldeferred("addchild", randomenemy2)
parentnode.calldeferred("addchild", random_enemy3)
I also have an issue with spawning multiple enemies of the same kind; it says they're already children of node "Enemies" (the node that I spawn them under). This only means one enemy of each kind gets spawned. Help would be very appreciated!