How do I use Array.json?

  • Hello. And happy New year.

    The new Arrays editor looks good, but i don't understand how it work.

    I have created an array.json in the Files folder and edited with my own row and column's names.

    Then I use AJAX To assign this array.json to an Array object.

    But when i do this the Array object don't take the renamed columns, but only classical numbers.

    You can see the array in the Debug mode don't show Time, Red, Blue, or 100, 101, 102, as i have specified in the array.json

    Did i do something wrong? Or perhaps is it not the use of the Array editor?

    Thanks...

  • Column and row names are not part of the array, they don't have co-ordinates, just for viewing purposes in the editor.

  • Thanks Plinkie.

    Ok. Then I don't understand clearly the usefulness of renaming the columns and rows. Only to fill temporary some range?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just for usability in the editor I guess. If you had tons of columns with similar values you might easily forget what they are.

  • We'd seen quite a few users placing titles and comments in arrays to make it easier for them to work with the files. But this of course adds areas of non-data to your data file, making it larger and more complicated to read. So the change was just to improve the editor workflow for those people.

    If you want to refer to a column by name you could add some constant variables to your event sheet, then use those variables to lookup the data from the array.

    LEVEL_DATA_TIME = 0
    LEVEL_DATA_RED = 1
    LEVEL_DATA_BLUE = 2
    LEVEL_DATA_YELLOW = 3
    LEVEL_DATA_GREEN = 4
    
    Array.At(index, LEVEL_DATA_TIME)
    

    However, if you prefer to actually index by a string then you might want to look into the JSON plugin. As it gives you a lot more flexibility to your data structure.

  • Thanks Nepeo.

    Ok I understand now that's only visual help.

    Good idea the constant variable. :-)

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