View Single Post
  #3  
Old 06-26-2009, 06:40 AM
Riot Riot is offline
Delteria Management
Join Date: Nov 2003
Location: Seminole County, Florida
Posts: 280
Riot is on a distinguished road
Quote:
Originally Posted by Robin View Post
Couldn't find any decent docs for this, anyone want to point me in the right direction?
I experimented with this a few days ago actually, this was a small sample I came up with:

PHP Code:
function onCreated() {
  
temp.walkable = {02};
  
temp.blocking = {1};
  
temp.stopping = {2};

  
temp.map = {
    {
0110111111},
    {
0000000111},
    {
0011110111},
    {
1000110011},
    {
1101111021},
  };
  
  
// tiles, walkable, blocking, stopping, non-stopping, startx, starty, length
  
temp.path findpathinarray(mapwalkableblockingstoppingnull0020);
    
  echo(
path); 

In this case, it returns:
"0,0","1,0","1,1","1,2","1,3","1,4","1,5","1,6","2 ,6","3,6","3,7","4,7","4,8"

You basically make a multidimensional array containing "tiletypes" and pass in the types it can and cannot walk on, as well as where it can stop.

You can also ignore the "walkable" types if everything not in blocking are walkable:
PHP Code:
temp.path findpathinarray(mapnullblockingstoppingnull0050); 
Reply With Quote