Dynamic maps

okay, i have run into a problem i just cant find a solution for.

My game is tile based, so i have an array with in it other arrays representing the map.

Now i want another array, just like the map array, but then only 0’s. I want this because my a* algorithm (I finally coded a working version! oh happy day :stuck_out_tongue: ) is based on 0’s and 1’s. The main array however is not just 0’s and 1’s but might go up to… well alot :stuck_out_tongue:

How would i do something like that, i have already tried:


_root.pathArray = mapArray;                
        for (i = 0; i < mapHeight; i ++)
            {
            for (j =0; j < mapWidth; j ++)
                {                        
                _root.pathArray*[j] = 0;
                }
            }    

And the same thing with concat. In both cases however if i change something in pathArray it also gets changed in the mapArray (reference?).

Just to clear up, i want an array such as below. In the same size but without any numbers but 0.

levelArray = [
[1,1,1,1,1,1,1,1,1,1],
[1,0,0,1,0,1,0,0,2,1],
[1,0,0,1,0,1,1,0,0,1],
[1,0,1,1,0,0,1,0,0,1],
[1,0,0,1,0,0,0,0,1,1],
[1,1,0,1,0,0,1,0,0,1],
[1,0,0,1,0,0,0,0,0,1],
[1,0,0,0,0,1,1,1,1,1],
[1,0,0,0,0,0,0,0,0,1],
[1,1,1,1,1,1,1,1,1,1]
]

like this.

pathArray = [
[0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0]
];

any help pl0x? Greatly appreciated.