Assign to 3D Array

Get help using Construct 2

Post » Fri Apr 12, 2013 4:44 am

Alright.. I am trying to do this:

code:
var array = [];
for(var x = 0; x < 18; x++){
    array[x] = [];
    for(var y = 0; y < 18; y++){
        array[x][y] = ["Data"];
    }
}



But I am having trouble with this in Construct2!

I am trying to do a FOR LOOP inside another FOR LOOP, y'know.. Like when you spawn a grid of tiles.
But the trouble right now is that I need to declare X, Y and Z positions to set the Data of an Array. But putting the loop names does not do the trick.

B
40
S
11
G
4
Posts: 665
Reputation: 8,403

Post » Fri Apr 12, 2013 6:39 am

Syntax would be: loopIndex("X Loop")
B
24
S
8
G
7
Posts: 756
Reputation: 7,192

Post » Fri Apr 12, 2013 9:08 am

Cheers :)
B
40
S
11
G
4
Posts: 665
Reputation: 8,403


Return to How do I....?

Who is online

Users browsing this forum: djcrazypants, marekmk and 6 guests