can anyone tell me how to make paths using mp_grid?
mp_grid
Started by 12warr12, Dec 08 2011 01:38 PM
2 replies to this topic
#1
Posted 08 December 2011 - 01:38 PM
#2
Posted 08 December 2011 - 02:20 PM
start by assigning mp_grid_create(...) to a variable, eg.
Next, block out any of the grid cells that you want to be unwalkable with functions like mp_grid_add_instances(...), etc.
For the path, start similarly:
Finally, to build the path based on the grid, use the function:
To make the object move on the path, use the function path_start(...).
my_motion_grid = mp_grid_create(...);Reference this variable with other mp_grid functions.
Next, block out any of the grid cells that you want to be unwalkable with functions like mp_grid_add_instances(...), etc.
For the path, start similarly:
my_path = path_add(); //you need to create a path to work with
Finally, to build the path based on the grid, use the function:
mp_grid_path(id, path, xstart, ystart, xgoal, ygoal, allowdiag); //put my_motion_grid for id //put my_path for path //the other variables are self-explanatory
To make the object move on the path, use the function path_start(...).
#3
Posted 08 December 2011 - 02:24 PM
If it helps to see examples as well as what turgon has posted, I have a whole host of them here :
http://nocturnegames.../aiexamples.htm
They are for all levels and most are fully commented so that you can learn from them.
http://nocturnegames.../aiexamples.htm
They are for all levels and most are fully commented so that you can learn from them.
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











