Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Random grass
- grid[0][i][j] = GlobalStaticVars.WORLD_VALUE.fromInt(GlobalStaticVars.RandIntRange(rndGen, 2, 4));
- // Random trees
- if (GlobalStaticVars.RandIntRange(rndGen, 1, 10000) < tree_density)
- {
- // Do not draw trees on world borders
- if (i == 0 || j == 0 || i == sizeX - 1 || j == sizeY - 1)
- continue;
- grid[1][i][j] = GlobalStaticVars.WORLD_VALUE.TREE_1;
- for (int a = 0; a < GlobalStaticVars.RandIntRange(rndGen, 1, 10); ++a)
- {
- for (int b = 0; b < GlobalStaticVars.RandIntRange(rndGen, 1, 10); ++b)
- {
- // Do not draw trees on world borders and boundary check
- if (a+i < 1 || b+j < 1 || a+i > sizeX - 2 || b+j > sizeY - 2)
- continue;
- grid[1][a+i][b+j] = GlobalStaticVars.WORLD_VALUE.TREE_1;
- // Try drawing tree's a bit more in the other direction
- if (GlobalStaticVars.RandIntRange(rndGen, 1, 2) == 2)
- {
- if (a-i < 1 || b-j < 1)
- continue;
- grid[1][a-i][b-j] = GlobalStaticVars.WORLD_VALUE.TREE_1;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment