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 ) 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
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.