I create simple RPG game on Android use Monogame and Xamarin and I have problem with tiles.
I use tiles 16x16 but I scale it to 32x32, I create simple Map Editor, I can create maps and convert to JSON format.
But after load map in game I see lines between tiles, These lines show where the object should be slightly transparent https://i.stack.imgur.com/ShN4A.png
Load Map
using (var stream = TitleContainer.OpenStream(path2))
{
spriteSheet2 = Texture2D.FromStream(graphicsDevice, stream);
}
currSprite = 2;
for (int y = 0; y < spriteSheet2.Height; y += 32 + 2)
{
for (int x = 0; x < spriteSheet2.Width; x += 32 + 2)
{
objects[currSprite].Add(new Rectangle(x, y, 32, 32));
}
}
using (var stream = TitleContainer.OpenStream("Content/x.png"))
{
test = Texture2D.FromStream(graphicsDevice, stream);
}
I debug it and use GIMP, in spritesheet anywhere these it lines In map editor I didn't see this lines, how I can fix it? I have this same code to load spritesheet in Map Editor and in game, in spritesheet I have 2px margin beetwen tiles.
(I must create album with images, because I can't give more than two links) https://i.stack.imgur.com/uSIwg.jpg
Image after change margin in code to 1px (See, first image in album)
Image after change tiles size to 31x31 (See, second image in album)
I get position floor tiles in spritesheet and use gimp I checked if the margins are too small, I zoom to this tile (See, third image in album)
I can eliminate white-lines when I set rectangle floor tile to 273, 69 and change size to 30, 30 (it's position rectangle without transparent lines in tile, but why transparent line have white color in game?) (See, last image in album)
I fix floor by eliminate transparent from tile, how I can fast fix it for all tiles?