Save and Load from JSON

For developers using the Construct 2 Javascript SDK

Post » Thu Mar 12, 2015 5:22 pm

I'm working on a behavior that is able to save Objects and restore them later on. I figured out how to save the object's sid and look it up later to get the object type for creating it, but when I try to "set from JSON" on a new layer, the object gets destroyed. I am reading the JSON that I get from asJSON, and it looks like the issue might be related to the layer SID that is stored.

I was wondering if there is a way to call the asJSON Expression from the SDK, and then later restore it in a way analogous to the "set from JSON" Action?
B
14
S
5
G
1
Posts: 189
Reputation: 1,536

Post » Thu Mar 12, 2015 11:33 pm

B
99
S
22
G
197
Posts: 4,206
Reputation: 113,777

Post » Fri Mar 13, 2015 12:47 am

Awesome! at first glance, this is really close to what I want to do!
B
14
S
5
G
1
Posts: 189
Reputation: 1,536


Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests