mirror of
https://github.com/AlexMacocian/MonoGame.Extended.git
synced 2026-07-18 00:19:30 +00:00
TryGetTile no longer returns a value if width is outside the map
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user