Hi, Happy New Year.
I am new to Construct 3 and am using it to build a puzzle game. The format of the game is a 3x3 grid of buttons which each have a pattern of spots on them. I need to get the board layout into a 2d array from a json file.
So the json looks like this.
{"1":{"layout": [[0,1],[1,3,4,7],[2],[2,3,6],[4,8],[1,3,5,8],[6],[4,5,7],[3,8]],...},
"2":{"layout": [[0,3,4],[1,5,7],[1,2],[3],[3,4],[2,5,6,7],[2,3,6],[0,7],[4,8]],...},
...}
In the json, the layout takes the format of a nested list of 9 elements, one for each button. The nested values (of which there is a maximum of 4 in each element) denote the pattern on each button.
Say that board number 1 is selected from the directory and the value is assigned to a variable called 'boardNum'. How do I assign the layout to a 9x4 array? E.g. layoutArray = boardnum.layout
One thing I suspect is not ideal is having the nested list in square brackets. I created the json directory in Python and made the layout as a Python list. I can easily change this format if required.
Thanks in advance for any help you can provide.
Cheers,
Pilsmer.