Open daithyy opened 6 years ago
With the help of a lecturer, we targeted the SimpleTileLayer draw event. He found a temporary solution which adds a 1 pixel offset to the left and right sides to the source rectangle.
sp.Draw(_tileSheet, new Rectangle(position.ToPoint(), new Point(t.TileWidth, t.TileHeight)), new Rectangle(t.TileRef._sheetPosX * t.TileWidth+1, t.TileRef._sheetPosY * t.TileHeight, t.TileWidth -1, t.TileHeight), Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0f);
Description: This appears in-game. When the camera moves along the map, the spaces in between the tiles show their gaps. It is apparent that there is a 1 pixel difference in between each tile. Note that the camera moves in floats, with the tiles set in fixed integer positions.
Cause: The cause of the bug is narrowed down to either the Camera, SimpleTileLayer or Tile classes.
Solution: To temporarily reduce the noticeable lines, the Sampler State of the draw in the tile maps was set to
SamplerState.PointClamp