Hi,
I want to spawn my enemy prefab within a certain area which is a 10×10 square so the start point of the area is Vector2 (0, 0) and the end point is Vector2 (10, 10). I can spawn enemies on random positions but it won’t look homogeneous obviously so what i want to do is spawning my enemy prefab within this certain area homogeneously. For instance a few spawn position could be; (1, 0) (2, 0) (3, 0) (1, 1) (2, 1) and so on. Can you point me a direction on how to do this type of spawn process?
Thank you in advance
Can’t you use a for loop to spawn all enemies and after every spawn add 1 to x pos
and if x pos has reached x max than go to a new row. Something like this:
int currentX = 0;
int currentZ = 0;
int xMax = 3; //Desired x size of row
for(int i = 0; i < enemyAmount; i++)
{
spawnPos = Vector3(currentX,enemyHeight,currentZ);
//Instantiate enemy here with the spawnPos
currentX+=1;
if(currentX>xMax)
{
//Start with a new row
currentX = 0;
currentZ +=1;
}
}