2D Toolkit Forum
2D Toolkit => Support => Topic started by: pangyan on January 18, 2014, 04:50:27 pm
-
When I use a pixel per meter setting of 100, TileMap works perfectly. However I create a camera with a pixels per meter setting of say 20 and then create a spritesheet I get the following overlap in the tiles in my TileMap:
(http://praveenangyan.files.wordpress.com/2014/01/overlap.png)
I'm dynamically loading up my TileMap using the following code:
// Use this for initialization
void Start()
{
Map map = new Map("Assets/Levels/test-load-level.tmx");
tk2dTileMap tk2dTileMap = GameObject.FindObjectOfType<tk2dTileMap>();
for (int layerIndex = 0; layerIndex < map.Layers.Count; layerIndex++)
{
foreach (Tile tile in map.Layers[layerIndex].Tiles.Values)
{
// Tiled's Gids are 1-based whereas 2D Toolkit's tiles are 0-based
tk2dTileMap.SetTile(tile.X, tile.Y, layerIndex, (int)tile.Gid - 1);
}
}
tk2dTileMap.ForceBuild();
}
-
The tile size is set up in the settings panel. If you change size on the sprite collection, you'll need to reset the tile size for it to detect the size from the sprite collection. Once you do that it should be fine.