making a slight edit to make note of what is going on bc i finally figured it out. When a new enemy is spawned in, its initial position is set as 0,0 which gets turned off then. going to try to initialize as -1,-1 and see if that helps

This commit is contained in:
2026-06-09 19:54:31 -04:00
parent d2993b17a4
commit e243d45d27
2 changed files with 1 additions and 9 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ public partial class Enemy : StaticBody2D
public delegate void ClickedEventHandler(Enemy THIS);
public bool _hovered = false, _track = false;
public int _damage = 1, _health = 2, _speed, _speedRemaining, _visibilityRange = 4;
public Vector2I _address, _range = Vector2I.Up;
public Vector2I _address = -Vector2I.One, _range = Vector2I.Up;
public List<Vector2I> _path = new();
public float _movement = 0;
public EnemyController _enemyController;
-8
View File
@@ -93,19 +93,11 @@ public partial class Map : TileMapLayer
{
_addressOccupants[ENEMY._address] = null;
SetCellSolid(ENEMY._address);
if (ENEMY._address == Vector2I.Zero)
{
GD.Print(4,_astar.IsPointSolid(ENEMY._address));
}
ENEMY._address = ADDRESS;
_addressOccupants[ADDRESS] = ENEMY;
SetCellSolid(ADDRESS);
if (ADDRESS == Vector2I.Zero)
{
GD.Print(5,_astar.IsPointSolid(ADDRESS));
}
}
public void SetCellSolid(Vector2I ADDRESS)