public void MoveAstar(Entity target, DungeonMap dungeonMap, List <Entity> entities) { var newMap = dungeonMap.DeepClone(); foreach (var entity in entities) { if (entity == this || entity == target || !entity.Blocks) { continue; } newMap.Tiles[entity.X, entity.Y].Walkable = false; } var path = new Path(newMap, 1.41); var pathExists = path.Compute(X, Y, target.X, target.Y); if (pathExists && path.Nodes.Count > 0 && path.Nodes.Count < 25) { var newLocation = path.Nodes[1]; X = newLocation.X; Y = newLocation.Y; } else { MoveTowards(target.X, target.Y, dungeonMap, entities); } }