Jump to content


Photo

mp_grid


  • Please log in to reply
2 replies to this topic

#1 12warr12

12warr12

    GMC Member

  • GMC Member
  • 678 posts
  • Version:Unknown

Posted 08 December 2011 - 01:38 PM

can anyone tell me how to make paths using mp_grid?
  • 0

#2 turgon

turgon

    VP Studios

  • GMC Member
  • 397 posts

Posted 08 December 2011 - 02:20 PM

start by assigning mp_grid_create(...) to a variable, eg.
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(...).
  • 0

#3 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 16793 posts
  • Version:GM:Studio

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.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users