Problems saving and loading

0 favourites
  • 8 posts
From the Asset Store
Progress\Loading Bar. Now Load you game like a Professional.
  • Hello, I would like to create a scoreboard for my game. Everything has worked well so far. However, saving and loading does not work properly. Everything works for the first run. The score is saved and loaded the next time. But if you start another round after that without restarting the game, the scoreboard doesn't save anything. What is the reason for this if it works the first time? The numbers and their names are saved in an array. In order to save the values permanently, the array is loaded as a string into a variable and this is saved in a local storage. When loading, the string is loaded from the local storage into a variable, after which it is transferred back into the array. See picture.

    I am also a complete beginner and this may not be the best solution. Please bear with me a little.

  • Hi.

    You don't need an intermediate variable.

    You can immediately save the array data to local storage.

    And when you load a slice from the local storage, load the data into the array.

    I see you are comparing the record using a trigen once.

    I would advise you to put all these comparisons inside the menu button event.

    You press the "menu" button did all the record comparisons, if you need to save the values to an array and then you save that array to the local storage.

  • Hi,

    I have now done the whole thing so that the array is now saved directly. But unfortunately it still doesn't work. When I add all the functions to the menu, the data sets are only updated for the player when the layout changes. Then he can no longer see his score.

  • I'm not good at explaining.

    Here's an example of how I do it.

    dropmefiles.net/en/fEAMD2NLc8

  • Hi, sorry for the late feedback. I had final exams. I took a look at your project. But I couldn't find any real difference. I have adjusted it a little for myself. Now all the places work except for the first place. But the first place doesn't change. I simply added a clear array so that the number in the array is reset after the game. All the others work as they should. Do you have any other ideas?

  • Returning to your original question, in the second post you are clearing storage immediately after saving to it, that isn't going to do anything. On the first post it depends when you are saving and loading. We can't see the layouts or structure, probably it works if you perform save and load at the right times, maybe you are saving too early, hard to tell from just the screenshots.

  • It can't be that I save too early. In the meantime, all the places are working except for the first one. The first place is simply not overwritten. All the other places can be overwritten. That's the funny thing about it. If I saved too early, there would be nothing left.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I have now also found out that the function is not called from place 1. It does not compare the values. But I don't understand why. The other places do it too. And in principle it's all the same.

    But if the save and load function is switched off, the function from the first place works for some reason.

    See screenshot 2, number 5

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