- Home /
 
               Question by 
               SYNYST3R1 · Feb 13, 2012 at 11:00 PM · 
                2drandomproceduraltile  
              
 
              Random 2D tile engine question
 void Start () {
     tiles[0] = grass;
     tiles[1] = dirt;
     
     Generate(0,0,20,20);
 }
 
 void Generate(int i, int j, int Width, int Height) {
     width = Width;
     height = Height;
     for (i = 0; i < width; i++) {
         for(j = 0; j < height; j++) {
             clone = Instantiate(tiles[Random.Range(0,tiles.Length)],new Vector2(i*tileWidth, j*tileHeight),Quaternion.identity)as GameObject;
         }
     }        
 }
Is this the way I should generate a random tile engine or is there a better way? How can I make is so I can edit the tiles and change their textures during runtime? Is there a way to lower say the amount of dirt that is generated so that there is more grass than dirt?
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                