M
mzn528
Guest
Hello All, I am back again with a question regarding AI and path finding.
I am currently using mp_grid as a way for enemy to do path finding, how I set this up is:
Now the issue with this is, the enemy is able to find me alright but as soon as I collide with obj_bound (the invisible wall to stop player from going beyond), the path will end and mp_grid_path(...) will return false and therefore make it stop.
Any idea how I can fix this? Thank you so much!
I am currently using mp_grid as a way for enemy to do path finding, how I set this up is:
Code:
Create Event:
ai_grid = mp_grid_create(0,0,room_width/32,room_height/32,32,32);
ai_path = path_add();
mp_grid_add_instances(ai_grid,obj_bound,true);
Step Event:
if(mp_grid_path(ai_grid,ai_path,x,y,player_x,player_y,false))
{//if the path is available then start the path
path_start(ai_path,moveSpeed,path_action_stop,false)
}
else
{//else stop, end path and switch state
speed = 0;
path_end();
state_switch(st_active);
}
Any idea how I can fix this? Thank you so much!