- Home /
Question by
greay · May 27, 2012 at 09:14 PM ·
tilemapprocedural
Having trouble getting Tidy Tile Mapper API to generate overhead levels
Has anybody had any luck with this? Setting the growth axis to "BlockMap.GrowthAxis.Forward" seems to generate all the chunks piled on top of each other no matter what I do.
var blockPrefab:GameObject = Resources.Load("StandardBlock");
var chunkSize:int = 5;
this.tileMap = BlockUtilities.CreateBlockMap("tiles", Vector3.one, chunkSize, chunkSize, BlockMap.GrowthAxis.Forward);
// this.tileMap.transform.position = b.min;
b.size = Vector3(30, 30, 5);
var block:Block = null;
for (var x:int = 0; x < b.size.x; x++) {
for (var y:int = 0; y < b.size.y; y++) {
for (var z:int = 0; z < b.size.z; z++) {
if (TileIsWall(Vector3(b.min.x + x, b.min.y + y, b.min.z + z))) {
block = GameObject.Instantiate(blockPrefab).GetComponent(Block);
BlockUtilities.AddBlockToMap(this.tileMap, block, false, 0, false, x, y, z, false, true);
}
}
}
}
var randomiseInitialMap:boolean = false;
BlockUtilities.RefreshMap(this.tileMap, randomiseInitialMap);
This more or less works if I create the block map setting the growth axis to "Up", but I can't figure out why it won't work the other way. Is it just a bug in Tidy Tile Mapper?
Comment
Best Answer
Answer by biosopher · Nov 16, 2012 at 05:58 PM
I just copied the code from the Runtime API and it worked perfectly after I set the growth axis to forward.
http://api.dopplerinteractive.com/tidy-tile-mapper/runtime-api/blockutilities/addblocktomap
This was actually a bug that has since been fixed. So yeah, the example code does work now.