How do I make it so two variables don't get changed when saving and loading?

1 favourites
  • 4 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • When my character enters the shop it goes to a different layout so I made it so it saves the previous layout since I don't want the coins to reset. So when the person buys something from the shops the coin variable is reduced and the item variable is increased. But when I press the button it loads the layout and the previous variable so the coins haven't reduced and the item variable is 0. How would I solve this solution?

    Many thanks if anyone can help me.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • When you say coins to reset do you mean a variable or a number of objects? You should use a global variable as the value carries over between layouts and you can save any time.

  • The coins are a number of objects not a variable. Is it possible just to save the Global variable individually without saving the layout objects and background?

    Thanks for replying

  • You need to be able to save after the shop, or any time. Have a look at the Persist behaviour because it sounds like your problem is with the coin objects and their state. The Persist behaviour added to the coin means they won't reset.

    You can in theory save only the global variable in local storage each time and keep loading its value, but why not save the whole game ?

    If this still doesn't resolve it, please give a better idea of what the game is and the design around the coins and the resetting.

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