how do i Create a map editor that shares users creation?

Get help using Construct 2

Post » Sun Mar 22, 2015 9:32 pm

Hello everyone, i already build a map editor but would like to know if there is a way to let the users share their creations???
Image
B
32
S
12
G
4
Posts: 296
Reputation: 6,264

Post » Sun Mar 22, 2015 10:58 pm

It's a little involved, but quite doable. You serialize objects using the asJSON expression, which basically turns an object into a string. You can then put all the JSON strings into an array, then JSON the array, which give you one long string that represents the entire level. You can put this big string into a text file, or upload it to a database somewhere for sharing.

To get your level back, get that string back form the text file or database, then create an array and setFromJSON. Then, for each item in the array, create an object and setFromJSON on that object, using the text from that point in the array. You may need a separate array to remember what type of object you need to create. Keep doing this and popping the strings out of the array until it is empty :)
B
14
S
5
G
1
Posts: 189
Reputation: 1,536

Post » Mon Mar 23, 2015 12:59 am

@_@ thanks
Image
B
32
S
12
G
4
Posts: 296
Reputation: 6,264

Post » Mon Mar 23, 2015 1:21 am

ok i just realized that i have no idea of how to do that :v
Image
B
32
S
12
G
4
Posts: 296
Reputation: 6,264

Post » Tue Mar 24, 2015 1:58 am

Start with figuring out how to save and restore one type of object from JSON, and go from there. All the rest builds on that :)
B
14
S
5
G
1
Posts: 189
Reputation: 1,536


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests