Hello, I have a variable STRING that saves the state of an object in JSON.
Can I access a data of that variable STRING in JSON to change a value?
How can I access a value in JSON format?
Maybe that helps? I'd just avoid manipulating json strings altogether if none of those ideas are viable.
Develop games in your browser. Powerful, performant & highly capable.
I do not know what to do, everything is due to a ZIndex error.
I need to access the JSON data to alter the value of ZI and put the new value there.
This is because when you create an object you now have a new ZI and it does not match the one in JSON at the time you saved your JSON status.
What is the easiest thing I can do?
I'm testing with a REX plugin, maybe I'll get results.
The plugin I guess.
Even if you are able to change the zindex in the json what good is it if it's not used when loading from json?
I create and load the state of the object from JSON but there is a problem with the ZI variable.
Then I check if the state of the object is different from the state in JSON saved previously, if it is different, then I save the new state in JSON.
Because of this "problem" with the ZI variable, the state is always different because the JSON ZI variable and the newly created object do not match.
So I use the plugin to match them.
I create the object.
I write in JSON (previously saved) the new ZI value.
I assign the JSON state to the object.
When the level is finalized I compare the states (sprite.asJSON <> stateJSON)
If there are differences in the states then -> stateJSON = sprite.asJSON
Now when comparing the state of the object (sprite.asJSON) with the state saved in the JSON chain, it will only be saved if something has changed (such as the damage it has or the coordinates).
I'm doing tests with a REX plugin to get that.