Pfap
Member
My instance always successfully draws the path, but sometimes won't follow it. It seems that it is getting stuck somehow.
Grid creation code
The above debugs and draws as expected.
Enemy object
My wall object is 8x8 pixels, while my enemy sprite is 32x32 could this be what is causing the problem?
And if that is my problem is there a way I can tell the grid to run the path check with an 8x8 object and then have my 32x32 object just follow the path anyways?
I'm thinking a solution like quidditch where I send an object with 8x8 dimensions after the player and just instruct the enemy to chase that? Or rather copy that path and have the enemy follow it.
I've been trying to get this solved for a few hours and I'm not entirely sure what is going on here.
Edit:
I tested with a sprite that is 8x8 and uploaded a video. The enemy sprites are the neon green squares. The path is always drawn and they sometimes just decide not to follow it.
Grid creation code
Code:
global.grid_m = mp_grid_create(0, 0, room_width / 8, room_height / 8, 8, 8);
mp_grid_add_instances(global.grid_m, wall, false);
Enemy object
Code:
if path_exists(new_path){
path_delete(new_path);
}
new_path = path_add();
if mp_grid_path(global.grid_m,new_path,x,y,player.x,player.y,0){
path_start(new_path, 1, path_action_stop, 1);
}
else{
show_debug_message("path creation failed");
}
My wall object is 8x8 pixels, while my enemy sprite is 32x32 could this be what is causing the problem?
And if that is my problem is there a way I can tell the grid to run the path check with an 8x8 object and then have my 32x32 object just follow the path anyways?
I'm thinking a solution like quidditch where I send an object with 8x8 dimensions after the player and just instruct the enemy to chase that? Or rather copy that path and have the enemy follow it.
I've been trying to get this solved for a few hours and I'm not entirely sure what is going on here.
Edit:
I tested with a sprite that is 8x8 and uploaded a video. The enemy sprites are the neon green squares. The path is always drawn and they sometimes just decide not to follow it.
Last edited: