Hello! It's my first attempt to use a dictionary for collecting some data.
I would like to count every time the player manually restarts (like pressing a button) or dies from the game in that specific layout, for each layout in the game. Ex:
Room1
Restarts: 5
death: 2
Room2
Restarts: 3
death: 1
and so on. So in a sense, it's an array.
Since it's been a while I made even the simplest database ever, I was wondering if it's possible to use the dictionary for this purpose. Once the game is ended, it will release a downloadable .json file with the written data.
This is all I have to say that doesn't make the question more confused.
Here below some of my experiments:
Before posting this topic, I tried following my instinct and worked it out with trial-and-error. The project partially works: In each layout, the game creates a new dictionary with the name of the room on it, plus all the details like I mentioned before. There are two problems, however: If you go to the next layout, the first dictionary may take the name of the next layout. Furthermore, the data from the first dictionary continue to get collected even after passing through another layout.
When I extract the text file, the data from the layouts I played are redundant.
What do you think I should do next?
Thank you!