How do I create rooms with arrays?

Get help using Construct 2

Post » Sun Jan 08, 2017 7:41 pm

I just want to make a way to place boxes on the map with an array almost like spelunky...

http://tinysubversions.com/spelunkyGen2/

Image

i have my blocks set with 1 being filled and 0 being empty like this;
Code: Select all
{"c2array":true,"size":[15,12,1],"data":
[[[1],[1],[1],[1],[1],[1],[1],[1],[1],[1]],
[[1],[0],[0],[0],[0],[0],[0],[0],[0],[1]],
[[1],[0],[1],[1],[0],[0],[0],[0],[0],[1]],
[[1],[0],[0],[0],[0],[0],[0],[0],[0],[1]],
[[1],[1],[1],[1],[1],[1],[1],[0],[0],[1]],
[[1],[0],[0],[0],[0],[0],[0],[0],[0],[1]],
[[1],[0],[0],[0],[0],[0],[0],[0],[0],[1]],
[[1],[0],[0],[0],[0],[1],[1],[1],[0],[1]],
[[1],[0],[0],[0],[0],[0],[0],[0],[0],[1]],
[[1],[1],[1],[1],[0],[0],[0],[1],[1],[1]]]}


Image
When I press J it loads it to ajax, but pressing K does nothing to the array. The values don't change in the debug editor and I'm lost.

Image
And sometimes it randomly just gives this when I keep pressing the buttons...

What's wrong with all of this?

Like I don't want anything complicated I just want the game to read the maps from 0(empty),1(solid blocks) and later 2(enemies) and 3(gems).
B
10
S
2
G
1
Posts: 51
Reputation: 848

Post » Sun Jan 08, 2017 9:25 pm

littanana wrote:
i have my blocks set with 1 being filled and 0 being empty like this;
Code: Select all
{"c2array":true,"size":[15,12,1],"data":
[[[1],[1],[1],[1],[1],[1],[1],[1],[1],[1]],
[[1],[0],[0],[0],[0],[0],[0],[0],[0],[1]],
[[1],[0],[1],[1],[0],[0],[0],[0],[0],[1]],
[[1],[0],[0],[0],[0],[0],[0],[0],[0],[1]],
[[1],[1],[1],[1],[1],[1],[1],[0],[0],[1]],
[[1],[0],[0],[0],[0],[0],[0],[0],[0],[1]],
[[1],[0],[0],[0],[0],[0],[0],[0],[0],[1]],
[[1],[0],[0],[0],[0],[1],[1],[1],[0],[1]],
[[1],[0],[0],[0],[0],[0],[0],[0],[0],[1]],
[[1],[1],[1],[1],[0],[0],[0],[1],[1],[1]]]}



Why you set "size":[15,12,1] ?
when this is obviously 10x10x1 array (10 rows & 10 cells in each row)
B
65
S
23
G
7
Posts: 1,512
Reputation: 10,910

Post » Sun Jan 08, 2017 9:36 pm

Make sure the data has finished loading before using it: Ajax -> on <tag> completed.
Image
B
30
S
9
G
3
Posts: 171
Reputation: 3,329


Return to How do I....?

Who is online

Users browsing this forum: Elliott, kellehk, oosyrag and 35 guests