Thread: findAreaTiles
View Single Post
  #1  
Old 03-12-2010, 01:23 PM
Cubical Cubical is offline
Banned
Join Date: Feb 2007
Posts: 1,348
Cubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant futureCubical has a brilliant future
findAreaTiles

I needed these momentarily for comparing tiles, doubt it will be of any help but who knows.

findAreaTiles returns a list of the tiles in the given area.
findAreaTiles2 returns a list of tiles in the given area and the x/y coordinates of said tiles in the following format "tile,x,y".

Parameters:
NPC Code:

findAreaTiles(x,y,width,height);
findAreaTiles2(x,y,width,height);



PHP Code:
function findAreaTiles(tx,ty,tw,th){
    for(
temp.i=0temp.< (tw*th); temp.i++){
      if(
temp.tw){
        
temp."0";
        
temp.j++;
      } else 
temp.q++;
      
temp.tilearray.add(tiles[tx+temp.q,ty+temp.j]);
    }
    return 
temp.tilearray;
}

function 
findAreaTiles2(tx,ty,tw,th){
    for(
temp.i=0temp.< (tw*th); temp.i++){
      if(
temp.tw){
        
temp."0";
        
temp.j++;
      } else 
temp.q++;
      
temp.tilearray.add(tiles[tx+temp.q,ty+temp.j] @ "," tx+temp."," ty+temp.j);

    }
    return 
temp.tilearray;


Last edited by Cubical; 03-12-2010 at 01:38 PM..
Reply With Quote