P
Psytrese
Guest
I'm using a grid-based pathfinding system which for the most part works great but I've been having issues with pathfinding where the enemy will stop advancing if I'm too close to a wall.
I don't know if it's my movement script that's the problem (apologies, I don't know how to tag code):
goal_x = argument0;
goal_y = argument1;
pathspeed = argument2;
global.move_to_path = path_add();
grid_size = 32
grid_set = mp_grid_create(0,0,room_width/grid_size,room_height/grid_size,grid_size,grid_size);
mp_grid_add_instances(grid_set,obj_wall,false);
failed_bool = mp_grid_path(grid_set,global.move_to_path,x,y,goal_x,goal_y,true);
path_start(global.move_to_path,pathspeed,false,false);
return failed_bool;
It's so easy to use this limitation to your advantage as my enemies have an aggro range and won't attack if you're out of range, so you can walk up to a wall, the enemy will stop advancing, then you can move out of range completely bypassing the fight.
Is there anything I can do to prevent this from happening?
I don't know if it's my movement script that's the problem (apologies, I don't know how to tag code):
goal_x = argument0;
goal_y = argument1;
pathspeed = argument2;
global.move_to_path = path_add();
grid_size = 32
grid_set = mp_grid_create(0,0,room_width/grid_size,room_height/grid_size,grid_size,grid_size);
mp_grid_add_instances(grid_set,obj_wall,false);
failed_bool = mp_grid_path(grid_set,global.move_to_path,x,y,goal_x,goal_y,true);
path_start(global.move_to_path,pathspeed,false,false);
return failed_bool;
It's so easy to use this limitation to your advantage as my enemies have an aggro range and won't attack if you're out of range, so you can walk up to a wall, the enemy will stop advancing, then you can move out of range completely bypassing the fight.
Is there anything I can do to prevent this from happening?