Hi Everyone,
I'm making a procedural City generator using nested for loops;
public Regions[] regions;
for (int x = 0; x < gridX; x++)
{
for (int z = 0; z < gridZ; z++)
{
if (x < gridX/region && z < gridX/ region) <--- what i need to replace
}
}
I have done quite a bit of work on it now but what i want to add next is regions, and i cant figure out the math in my head.
![alt text][1]
[1]: /storage/temp/188590-capture.png
In the example image I could just get the x and z's below and above half but I would like to be able to add as many regions as I want and for it to calculate groups similar to the image above.
maybe using a percentage or something? i dunno my mind has gone black from looking at it so much...
Thanks in advance!
↧