I know, I know, this has already been discussed more than once. But I don’t understand the algorithm itself. I easily save existing objects on the stage and their variables and load them using structure+json. But when creating new objects, their preservation and subsequent creation at given points is a problem.
The algorithm itself looks like this to me:
- All objects need an identifier, which can be assigned immediately after the object is created and stored in its ID variable.
- A structure is created (scene variable) in which there can be several fields that record the x,y position, animation, etc.
- Everything is saved, added to json and ok.
- But when loading, either not all objects are created, or in the wrong places. Although when saving, the action is used - repeat for each object on the scene.