[Request] Object as JSON string

0 favourites
  • 7 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hello,

    Not sure if this feature is already in C2 as I can't find it, but I would think this would be a great feature to be able to instantly export the whole object with its position variables and behaviors etc to JSON string in to an array value for example and to be able to load it with single action Create object from string. What you guys think?

    EDIT@ Corrected myself. I'm not grasping easily all that programming lingo.

  • Hmm, I guess this could be useful - what do you plan to use it for? Generally you should provide as many good use cases as you can for a feature, so we can prioritise it correctly.

  • Hi, sure, atm I would use it for storing those asJson objects into arrays responsible for storing levels ( then exporting those arrays asJson in to external files ). I've got many types of same types of objects there in different sizes with many different variables responsible for different conditions. Now, when I want to load a level with all the data., on creating the objects I have to set all parameters and variables manually one by one using tokenat, and it ends up being a lot of conditions and actions. Also later down the line the number will increese due to more objects and data I will be adding.

    I would imagine it would work something like this in my case

    • For each Platform(Family): Set Value at X,Y,Z,Platform.asJson
    • Ajax; On completed: Array: load from JSON string AJAX.LastData

    - For each XYZ element & Current value =/= 0: create object from JSON string Array.CurValue

    So that's how I would currently use it, but obviously it could be used with other data storages, or even multiplayer games for setting data to transfer!

    Thanks!

    EDIT@ Don't want to add to much, but it could go even as far as export layout and layer as json.

    EDIT2@ And thinking about it bit more, maybe there should be to types of storing or an option to either store with position on the layout or without it. Just looking at it from different usability angles.

  • Ashley I mentioned this to you briefly when I popped by the offices. For us it would be a great way to save/load particle object states for weather effects.

  • Totally. I think now that I would use that for storing everything that would have to have different parameters and values on creation.

  • +1 Managing objects in custom level editors is brutal right now. This would significantly lighten the workload.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Having a conversion between objects and JSON can be useful when transferring data with WebSocket.

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