0 Favourites

How do I create rooms with arrays?

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

    http://tinysubversions.com/spelunkyGen2/

    i have my blocks set with 1 being filled and 0 being empty like this;

    {"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]]]}[/code:omitk5ov]
    
    [img="http://i.imgur.com/1DH53kS.png"]
    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.
    
    [img="http://i.imgur.com/ABKQuEs.png"]
    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).
  • i have my blocks set with 1 being filled and 0 being empty like this;

    {"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]]]}[/code:oup7va4q]
    
    

    Why you set "size":[15,12,1] ?

    when this is obviously 10x10x1 array (10 rows & 10 cells in each row)

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Make sure the data has finished loading before using it: Ajax -> on <tag> completed.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)