Merge pull request #755 from LokiMidgard/TryGetTile-fix

TryGetTile no longer returns a value if width is outside the map
This commit is contained in:
Lucas Girouard-Stranks
2022-03-05 13:01:28 -05:00
committed by GitHub
@@ -28,6 +28,11 @@ namespace MonoGame.Extended.Tiled
public bool TryGetTile(ushort x, ushort y, out TiledMapTile? tile)
{
if (x >= Width)
{
tile = null;
return false;
}
var index = GetTileIndex(x, y);
if (index < 0 || index >= Tiles.Length)
@@ -57,4 +62,4 @@ namespace MonoGame.Extended.Tiled
SetTile(x, y, 0);
}
}
}
}