add cursor bounds check #3

This commit is contained in:
Cat Flynn 2022-12-06 19:50:53 +00:00
parent 4ddb3cebf6
commit 8d122b650f
1 changed files with 3 additions and 0 deletions

View File

@ -47,6 +47,9 @@ public class WorldGrid : Node2D
public void ToggleTileHighlight(int x, int y) public void ToggleTileHighlight(int x, int y)
{ {
if (!IsInBounds(x, y))
return;
_tiles[x, y].isHighlighted ^= true; _tiles[x, y].isHighlighted ^= true;
} }