TinyDB transform list of SPRITE into TXT

I'm saving a SPRITE list to a TinyDB tag (1). The list does not contain "
When I retrieve the saved tag, the list is transformed into text (2) and I cannot find my SPRITES.

How can I transform texts into SPRITE name?

You cannot store runtime components to the tinydb. As you have seen they are converted to strings if you try.

Because components like spites are generate at runtime, they have a different component name/ref on each run of the app. Therefore you need to save these as a list (of components) and just work with that list (which is also built at runtime). You can always work with indexes saving a length of list to the tinydb, my experience has been that the runtime components are always created in the same order..

1 Like

Too bad for me
I will find another solution. it's in case my app crashes, I save a precise list of sprites, but if it generates the sprites at each launch, it's dead
Thank you

The sprites will be there next time you start the app, do you want to save their positions, images, other details?

My application is used to make statistics for my team's handball matches.
I have 14 sprites representing 14 players among the 30 of the team, I have 7 sprites representing the 7 players on the field and 3 sprites representing the sanctioned players.
By doing tests, my app sometimes crashes, I want to be able to resume the match quickly after a bug. I therefore wish to safeguard who is in play, who is on the sidelines and who is sanctioned. This is why I was saving the sprite list.
In the beginning, I assign players to sprites, so I'll save indexes in the field and put them back in case of a crash

You may also want to use this:

to prevent your sprites from eating each other :wink:

You should also look carefully at when the app crashes to see if you can resolve that issue.

Here also an example of saving sprite locations and images for rerun of app

Don't confuse the image of a player with his name. Keep the name and use that to look up images when you need them. Sprites come and go, but names are forever (almost).

Sample projects to read:

for record keeping

I have no problem with my SPRITE, Name, image, drag... My app is working fine. Sometimes it crashes I don't know why. That's why I want to make a recovery system for certain elements.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.