I have a game where there are multiple enemies who must chase a single player. I have pathfinding set up using the GML A* pathfinding with mp_grid and a path. However, these enemies can walk on top of each other when seeking the player. To fix this, I also told the path to ignore enemies as well with mp_grid_add_instances, but then they stop moving altogether because they see themselves as obstacles, thus trapping themselves within a bounding box. Is there a way I can add "all other enemies BUT self" with mp_grid_add_instances?
Here's my grid creation code (in a CONTROLS class for initializing variables):
global.zombie_ai_grid = mp_grid_create(0, 0, room_width / 50, (room_height - sp_dashboard.sprite_height) / 50, 50, 50);
mp_grid_add_instances(global.zombie_ai_grid, obj_obstacle, false);
This is my path initialization code (in Zombie class):
path = path_add();
alarm[0] = 5;
This is my path creation code in Alarm 0 (path updates every 2 seconds):
mp_grid_path(global.zombie_ai_grid, path, x, y, nearest.x, nearest.y, true);
path_set_kind(path, 1);
path_set_precision(path, 8);
path_end();
path_start(path, MAX_SPEED, 0, true);
alarm[0] = room_speed * 2;