How do I Save One object as JSON or Array Data?

0 favourites
  • 6 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • I am having a great difficulty figuring out how to load zones of objects (like large streaming engine games that allow travel over great distances). Sans switching game engines, I dont see many examples about doing something like this, especially because of localstorage constraints perhaps...

    How do I find the specific command for saving ONE OBJECT's data as a JSON file? Is it through arrays only? I can figure out how to build an object into an array I guess. Assigning strings and number values to be loaded from on the fly while in certain regions every amount of time I guess. Thats one way. Anyone know of other ways to approach this problem? I'm used to being able to literally disable objects in other engines and disable them or enter them dormant. In construct 2 this is just not possible. They must be destroyed completely and even then I hear theyre still in memory. So youre going to have to re-use objects or something....

  • What do you mean by ONE OBJECT's data?

    Which data would this be and how are you tracking this data right now?

  • i was planing to load up a array by putting all the data in the array on one line as json But i read a post Ashley write state its no good to load a like this way it take up memory on make game take long to load

    on start of layout array load on paste in the code simple

    "{""c2array"":true,""size"":[200,111,1],""data"":[[[""NAME""],[""J""],[100]]]}"

    she say it best to load it from a file so search the forum on how to use ajax. As a start for me i just forget about arrary

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • i was planing to load up a array by putting all the data in the array on one line as json But i read a post Ashley write state its no good to load a like this way it take up memory on make game take long to load

    on start of layout array load on paste in the code simple

    "{""c2array"":true,""size"":[200,111,1],""data"":[[[""NAME""],[""J""],[100]]]}"

    she say it best to load it from a file so search the for on how to use the ajax as a start for me i just forget about arrary

    Ouch, I didnt know we arent supposed to use a ton of arrays for object management, are arrays the only things that can save object data as JSON?

  • As this manual entry states, asjson is a common expresion..

    Many objects have it..

    https://www.scirra.com/manual/133/common-expressions

    The sprite-object itself has an asjson expresion and load from json action, that's why I asked my previous question..

  • I figured it out everyone thank you. I didnt realize that asJSON is a state string with numbers and letters.

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