Dr_Nomz
Member
So recently my NPCs were acting stupid by clearly ignoring an open door and trying to walk around it, or worse yet, walking THROUGH a closed door, since the above code was in the create event of the grid object.
I fixed this just fine, but I want to ask this to make sure this won't cause problems down the road.
Create event for all enemies:
Step event for enemy:
And don't worry, there grid object has an end game event that deletes the grid as well. That said, is it an issue, or should it be fine?
I fixed this just fine, but I want to ask this to make sure this won't cause problems down the road.
Create event for all enemies:
Code:
var cellh = 50;
var cellw = 50;
var horzcells = room_width div cellw
var vertcells = room_height div cellh
global.grid = mp_grid_create(0,0,horzcells,vertcells,cellw,cellh);
Code:
if (mp_grid_path(global.grid,path,x,y,obj_Character.x,obj_Character.y,true)){
path_start(path,4,path_action_stop,false);
mp_grid_add_instances(global.grid,obj_Wall,true);
}