Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: Adventure Bird on August 13, 2010, 04:57:38 PM

Title: 3D Array
Post by: Adventure Bird on August 13, 2010, 04:57:38 PM
It's long time ago since I used my last 3D array that uses normal arrays.

Maybe somebody could help me.
Here is the code:
Code: [Select]

var Spielfeld;
function initSpielfeld()
{
Spielfeld = new Array(15);
for ( var x = 1; x <= 15; x=x+1)
{
Spielfeld[x] = new Array(12);
for( var y = 1; y <= 3; y=y+1 )
{
Spielfeld[x][y] = new Array(3); // HERE is the problem with the two brackets
for (var z = 1; z <= 12; z=z+1 )
{
Spielfeld[x][y][z] = 0;
}
}
}
}
Title: Re: 3D Array
Post by: metamorphium on August 13, 2010, 06:22:04 PM
use tmp variable

Code: WME Script
  1.  
  2. var tmp = spiel[x];
  3. tmp[x] = 17;
  4.  
  5. spiel[x] = tmp;
  6.  
Title: Re: 3D Array
Post by: Adventure Bird on August 13, 2010, 10:38:28 PM
Thanks a lot.