Problem pulling values from an array

0 favourites
  • 4 posts
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • I am working on a sudoku game and am having trouble getting values out of an array. I load values into an array from a json file, the values show up in debug mode right where they belong. I am using a loop to pull the values out of the array and put them into the squares for the numbers. The first value comes out fine and sets the square to the correct number. From there on out I get only zero. I have shortened the array to simplify testing and the rest of the code and layout is kind of a mess from all my failed testing. But if anyone can help I would be very grateful. I have searched the forums and tutorials and have not found a solution.

    Here is a .rar of the whole project so it includes the files I am loading in.

    https://dl.dropboxusercontent.com/u/6234471/Sudoku4.rar

  • I came to the forums just to find out about my array problem. I'm having the same problem. I did find that a one dimensional array can only hold 10 elements. If you read the data at the 11th element I get a bogus result. The manual uses 0-9 (10 elements) as an example, but I guess that also means it's a limitation of the array function.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You are missing a level of square brackets. You only have two dimensions rather than three.

    (And you don't need to use RAR, save as CAPX - it does the same thing, and is the standard here for posting files).

    {

         "c2array":true,

         "size":[           1,           1,           5      ],

         "data":

         [           [                [                      "5","2","3","4","5"                ]       

              ]

         ]

    }

    curteck You set the array sizes either in the array's properties tab or via the 'Array:Set size' action.

  • THANK YOU blackhornet!!

    I didn't think if I just shared the .capx that my data file would be accessible.

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