A city created at run time that was instantiated along a grid. The reason for this post is to allow people to understand how to make something like this easy and simple. The city is instantiated along a grid using the restraints of the length and width perimeters passed through into the generator. Tiles are incremented through a constant that defines the width/length of the tile square. Here's the code I've constructed for the current explanation : var tileConstant:float = so and so number; var tileObject:GameObject; function BuildCity(desiredLength:int, desiredWidth:int){ var length:int=1; var width:int=1; while(length<=desiredLength){ Instantiate(tileObject, Vector3(width*tileConstant,0,length*tileConstant), Quaternion.identity); //incrementing if(length ==(desiredLength)&&width <desiredWidth){ length = 1; width +=1; }else{ length+=1; } ...
Learn to create games, a blog at a time.