getting a js bug Array.Height to number

  • I am working on loading data into a array form AJAX and that seems to be working fine. but then I am trying to load the Array.Height into a number(int) var. and I get a js error when I run the page "set_int.without a number type" but I then do a loop from 0 to the var I set and that seems to work. please see attachment for what I am doing in the code

    [attachment=0:2nfp5mug][/attachment:2nfp5mug]

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sounds like you might have set the array sizes as strings instead of numbers in the JSON file:

    "size":["10","1","1"][/code:gu0d88su] instead of [code:gu0d88su]"size":[10,1,1] [/code:gu0d88su] ?
  • Here is my array

    {

    "c2array": true,

    "size": "[8,7,1]",

    "data": [ [["Type"],["Y-Top"], ["X-Left"], ["Length"],["Dir"],["Movement"],["MovDir"]],

    [

    ["Plat"],["15"], ["0"], ["50"],["H"],["0"],["H"]], [

    ["Plat"],["15"], ["60"], ["20"],["H"],["0"],["H"]], [

    ["Plat"],["10"], ["79"], ["50"],["H"],["0"],["H"]], [

    ["Plat"],["27"], ["10"], ["30"],["H"],["0"],["H"]], [

    ["Plat"],["22"], ["36"], ["5"],["V"],["60"],["H"]], [

    ["Plat"],["29"], ["61"], ["15"],["H"],["100"],["V"]], [

    ["Latt"],["27"], ["40"], ["15"],["V"],["0"],["V"]]]

    }

  • It should be

    "size": [8,7,1][/code:1y0yqiex]
  • Try int(MapArray.at(loopindex,2)).

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