still attempting to allow enemies to handle their own animations. still a matter of improving performance and there's some issue when enemies reach rank 0?

This commit is contained in:
2026-06-24 03:00:23 -04:00
parent 8ae8ec3e58
commit 98ca292901
6 changed files with 84 additions and 86 deletions
+15 -14
View File
@@ -13,7 +13,20 @@ public partial class Map : TileMapLayer
public List<Vector2I> _cells = new(), _leftmostColumn = new(), _rightmostColumn = new(), _topRow = new(), _bottomRow = new();
public AStarGrid2D _astar = new();
public Dictionary<Vector2I, Enemy> _addressOccupants = new();
public int _firstOpenRow
{
get
{
for (int i = 0; i < _maxY; i++)
{
if (!IsRowFull(i))
{
return i;
}
}
return 1;
}
}
public override void _Ready()
{
base._Ready();
@@ -51,18 +64,6 @@ public partial class Map : TileMapLayer
return GlobalPosition + CELL_ADDRESS * _cellSize + _cellSize / 2;
}
public int GetFirstOpenRow()
{
for (int i = 0; i < _maxY; i++)
{
if (!IsRowFull(i))
{
return i;
}
}
return 1;
}
public Enemy GetOccupant(Vector2I CELL_TO_CHECK)
{
return _addressOccupants[CELL_TO_CHECK];
@@ -130,7 +131,7 @@ public partial class Map : TileMapLayer
{
_astar.SetPointSolid(FROM, false);
List<Vector2I> pathTaken = [.. _astar.GetIdPath(FROM, TO, true)];
List<Vector2I> pathTaken = [.. _astar.GetIdPath(FROM, TO)];
_astar.SetPointSolid(FROM, true);
if (!INCLUDE_FROM)