altering enemies into peg to open up for the future with hostile and friendly pegs. made some changes to the pathfinding. starting to add a mouse handler that will more easily handle single and double clicks, and holds. Enemy controller becomes peg controller and will handle all peg interactions

This commit is contained in:
2026-06-25 16:31:13 -04:00
parent e3cb4ef7ac
commit 37da9a4e84
23 changed files with 428 additions and 284 deletions
+9 -9
View File
@@ -12,7 +12,7 @@ public partial class Map : TileMapLayer
public Vector2I _pathTakenAtlasCoordinates = new Vector2I(4, 0);
public List<Vector2I> _cells = new(), _leftmostColumn = new(), _rightmostColumn = new(), _topRow = new(), _bottomRow = new();
public AStarGrid2D _astar = new();
public Dictionary<Vector2I, Enemy> _addressOccupants = new();
public Dictionary<Vector2I, Peg> _addressOccupants = new();
public int _firstOpenRow
{
get
@@ -64,7 +64,7 @@ public partial class Map : TileMapLayer
return GlobalPosition + CELL_ADDRESS * _cellSize + _cellSize / 2;
}
public Enemy GetOccupant(Vector2I CELL_TO_CHECK)
public Peg GetOccupant(Vector2I CELL_TO_CHECK)
{
return _addressOccupants[CELL_TO_CHECK];
}
@@ -90,20 +90,20 @@ public partial class Map : TileMapLayer
return rowCells.All(c => _astar.IsPointSolid(c));
}
public void SetCellEnemy(Vector2I ADDRESS, Enemy ENEMY)
public void SetCellPeg(Vector2I ADDRESS, Peg PEG)
{
if (ENEMY != null)
if (PEG != null)
{
if (ENEMY._address != -Vector2I.One)
if (PEG._address != -Vector2I.One)
{
_addressOccupants[ENEMY._address] = null;
SetCellSolid(ENEMY._address);
_addressOccupants[PEG._address] = null;
SetCellSolid(PEG._address);
}
ENEMY._address = ADDRESS;
PEG._address = ADDRESS;
}
_addressOccupants[ADDRESS] = ENEMY;
_addressOccupants[ADDRESS] = PEG;
SetCellSolid(ADDRESS);
}