HighlandCoo
Member
I have a physics enabled object that needs to navigate across a physics enabled room - avoiding walls as it goes.
I tried creating a grid, and mp_grid_draw confirms there is plenty of space to move.
I used this code
Using draw_path, I can see the path is created, but the object just goes skittering around the room in random directions.
What am I doing wrong??
I tried creating a grid, and mp_grid_draw confirms there is plenty of space to move.
I used this code
Code:
if mp_grid_path(global.grid,path,x,y,suspicion_x,suspicion_y,1)
{
phy_speed_x = lengthdir_x(spd,point_direction(x,y,path_get_point_x(path,0),path_get_point_y(path,0)))
phy_speed_y = lengthdir_y(spd,point_direction(x,y,path_get_point_x(path,0),path_get_point_y(path,0)))
}
else{
show_debug_message("no path found!")
}
What am I doing wrong??