﻿ 3D Array
• August 09, 2024, 05:13:40 PM
• Welcome, Guest

### News:

IRC channel - server: waelisch.de  channel: #wme (read more)

Pages: [1]

### AuthorTopic: 3D Array  (Read 3793 times)

0 Members and 1 Guest are viewing this topic.

• Lurker
• Karma: 0
• Offline
• Posts: 13
##### 3D Array
« 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; } } }}`
Logged

#### metamorphium

• Global Moderator
• Karma: 12
• Offline
• Gender:
• Posts: 1511
• Vampires!
##### Re: 3D Array
« Reply #1 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.
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

• Lurker
• Karma: 0
• Offline
• Posts: 13
##### Re: 3D Array
« Reply #2 on: August 13, 2010, 10:38:28 PM »

Thanks a lot.
Logged
Pages: [1]

Page created in 0.117 seconds with 22 queries.