Bingdom
Googledom
Hello GMC!
Today, i have encountered a really tough problem and i need help figuring it out.
So basically i currently have set up my AI path finding using mp_grid, and everything is working fine EXCEPT when i try to set a path to a forbidden cell. I want to know how to make the AI to move to the closest available cell after when the player has clicked on a forbidden cell, i'm unsure how to program an efficient method.
This is what im currently doing for the AI path finding.
If you're unsure what i mean here is a picture (excuse my bad writing )
Also, the tiles are stored in a ds_grid too, in case if it's needed.
Today, i have encountered a really tough problem and i need help figuring it out.
So basically i currently have set up my AI path finding using mp_grid, and everything is working fine EXCEPT when i try to set a path to a forbidden cell. I want to know how to make the AI to move to the closest available cell after when the player has clicked on a forbidden cell, i'm unsure how to program an efficient method.
This is what im currently doing for the AI path finding.
Code:
with(OBJ_Troop) {
var t_path = path_add();
if mp_grid_path(other.map_ai, t_path, x, y, mouse_x, mouse_y, true) {
path_assign(path, t_path);
path_start(path,3,path_action_stop,false);
}
path_delete(t_path);
}
Also, the tiles are stored in a ds_grid too, in case if it's needed.