TheBoneJarmer / TiledCS

TiledCS is a dotnet library for loading Tiled tilesets and maps
MIT License
139 stars 51 forks source link

Included tile spacing and margin in source rectangle calculation #94

Open treesgobark opened 1 year ago

treesgobark commented 1 year ago

DualStickSheet.zip Saw the discussion on #86. Here's a solution that also includes the margins and a tilesheet to test with. Note how each tile is 16x16 but has a 1 pixel border around it that matches the adjacent pixel. Margin is the thickness of the border around the entire tile sheet image whereas spacing is how many pixels are between any two tiles. This "extrusion" is used for solving gpu rounding errors that try to sample from the sprite sheet a tiny bit over the true border of the sprite and end up creating strange lines between tiles. Aseprite has an extrude option when exporting a tile sheet that does this for you if you want to make your own. https://www.aseprite.org/docs/sprite-sheet/