need help for array

Get help using Construct 2

Post » Wed Sep 28, 2016 10:27 pm

i read manual about array and watch some video on youtube. also reading post on this forum about array

finally im to zero again :(

OK! i know is a complex method and hard to understand some people like me with zero experience from any programming code..

i try to make a quiz with photo and music and text.. i found one post with and i download flag.capx
when i open i see onle 57 event .. ok !"i say this look easy".. i read and watch any event one by one so i can unsterdant what happen here..

1. i dont understand is how to but all this country on load json to array?? (don tell he writing all this one by one?? cause after 2 min i have daze with this allot [['" ]],[[ asd]][0]0, oh oO
2.ArrayQuestion - load form JSON string :so what is this 20,3,1 ? ..20 is the animation frame he have i think he use 20 cell to??,,
the 3?

and why he use 2 country ,[0],2country,[1]

"{""c2array"":true,""size"":[20,3,1],""data"":[[[""Bosnia and Herzegovina""],[""Sarajevo""],[0]],[[""Greece""],[""Atina""],[1]],[[""Slovakia""],[""Bratislava""],[2]],[[""Turkey""],[""Ankara""],[3]],[[""Albania""],[""Tirana""],[4]],[[""Barbados""],[""Bridgetown""],[5]],[[""Brasil""],[""Brasilia""],[6]],[[""China""],[""Beijing""],[7]],[[""Cuba""],[""Havana""],[8]],[[""India""],[""New Delhi""],[9]],[[""Kenya""],[""Nairobi""],[10]],[[""Sweden""],[""Stockholm""],[11]],[[""Vietnam""],[""Hanoi""],[12]],[[""Colombia""],[""Bogota""],[13]],[[""Nigeria""],[""Abuja""],[14]],[[""Philippines""],[""Manila""],[15]],[[""Ghana""],[""Saint Peter Port""],[16]],[[""Jamaica""],[""Kingston""],[17]],[[""North Korea""],[""Pyongyang""],[18]],[[""Serbia""],[""Belgrade""],[19]]]}"

im really confused with this array :(
B
15
S
7
G
7
Posts: 201
Reputation: 5,277

Post » Wed Sep 28, 2016 10:44 pm

Well can see that he use size 20,3,1 to make his array the size he need which is X size 20 Y size 3 and Z size of 1. Next to all the number is the X coor of the array so from 0 to19 is the total of 20 X coor size.

The first x y z coor are alway 0 0 1. If he has on one number used for each most likely its just an X value coor draw a grid based on his size and plug in the value he has for each X coor and you can see how it work.

Does this answer any question.
B
51
S
24
G
6
Posts: 391
Reputation: 7,820

Post » Wed Sep 28, 2016 10:50 pm

Don't try to read the JSON. JSON is a simply a data format for storing an array. You generally don't want/need to directly edit it, or to learn how to write JSON.

Basically, you can set up an array in a program and save it as JSON, and load it again later back into your array.

To generate the JSON, he probably prepared the array ahead of time and saved it as a file for easy use for his tutorial.

Simply - An array can be saved as JSON, and when that same JSON is loaded you'll get the array that you saved. You don't need to understand the JSON format itself.
Mistakes were made.
B
49
S
24
G
107
Posts: 1,581
Reputation: 60,303

Post » Wed Sep 28, 2016 10:54 pm

i have 500+ image and question so what i need to do?? writing one by one on JSON?? like this??

"{""c2array"":true,""size"":[500,3,1],""data"":etc etc ?? with all this [ ] " " , ?

@Gearworkdragon
B
15
S
7
G
7
Posts: 201
Reputation: 5,277

Post » Wed Sep 28, 2016 10:57 pm

@oosyrag "Basically, you can set up an array in a program and save it as JSON, and load it again later back into your array."

how do to this?? on this file flag.capx i did see any array save it as JSOn
B
15
S
7
G
7
Posts: 201
Reputation: 5,277

Post » Wed Sep 28, 2016 11:06 pm

Like I said, the creator of the tutorial probably did it ahead of time.

After setting up the array as you like, you can use the Array Download action to save as JSON, or use the asJSON expression to get a string with the contents of the array. You can then use the Array Load action to load that same string or file.

To set up your array manually the first time, you'll have to either parse in a .csv spreadsheet, which I recall describing to you a while back, or you can set each array cell with the Array Set At actions in Construct.
Mistakes were made.
B
49
S
24
G
107
Posts: 1,581
Reputation: 60,303

Post » Wed Sep 28, 2016 11:08 pm

oh ok i found it!! with Construct2 data Editor.. ok i got ti now :)
B
15
S
7
G
7
Posts: 201
Reputation: 5,277

Post » Wed Sep 28, 2016 11:31 pm

That is one third party program that can create JSON files.

But I want to reiterate that you can do the same within Construct itself for free.
Mistakes were made.
B
49
S
24
G
107
Posts: 1,581
Reputation: 60,303


Return to How do I....?

Who is online

Users browsing this forum: Ryan Kocourek and 12 guests