I am trying to figure out something weird going on. Maybe I just cannot wrap my head around the problem.
https://imgur.com/5HbO6ct
- Enemys spawn and then find path to the next checkpoint.
- If along the path they get a LineofSight to a Player_Solider they "Pathfinding STOP" and set the variable EnemyX to Player_Soldier.X, and variable EnemyY to Player_Soldier.Y , so this way it can store its target. (there may be an easier way, but not sure).
- Bullets Fire, Everything is smooth until one of the Enemy soldiers loses line of sight of its target.
So when the enemy loses line of sight and doesn't have sight to anything else it should follow the ELSE code and set SeesEnemy to 0 along with EnemyX to 0 and EnemyY to 0, and then find path to its target (didnt screenshot that part). Instead it will just sit there and fire until the other Enemys that still have a LineofSight destroy their target. Then they all move again, or they all just sit and continue firing at nothing.
Any help is appreciated. What am I doing wrong?