How do I make game settings persist to other layouts?

0 favourites
  • 7 posts
From the Asset Store
20 high quality click sounds, ready to improve your game's UI instantly
  • So I'm making this platformer, and I just got back into fixing my game settings, they're good, my only issue with them is that they don't persist to the next layouts, so, for example, if I set the game's language to be Spanish, it will reset to English in the next layout, and that happens to all settings, except the timer types (the current game settings the player can manipulate are screen luminosity, a hide UI option, game languages, character speed, and the player can opt between two types of timers), strangely, this setting seems to persist on most levels except in the Levels 2 and 3.

    I'm trying to use a local storage to save the settings variables to other layouts, but nothing really seems to happen.

    So far, this is all the code I got, since I haven't been coding a lot today. Am I missing anything important, or is there any incorrect logic? I've only been to Construct for around two years, so I'm a beginner.

    Tagged:

  • Local storage is used to save values between sessions. If you are just switching to another layout, you don't need Local Storage - simply store the values in global variables or in a dictionary.

    The reason your language resets is probably because you change it in "LocalStorage on any item get". So if you are reading other values from LS, like "Speed", it will overwrite the language value.

  • Well, I was already using global variables, and they still reset. But I'll use a dictionary and see what happens.

  • Well, I was already using global variables, and they still reset.

    They should not reset, unless you have an event that resets them.

  • Well, I tried on another project, I just added this variable, there are no possible events to reset them, and SOMEHOW, they still reset!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Can you share your project file?

    When you just switch to another layout, global variables definitely don't reset.

  • where do u call the data from dictionary? cause on start of layout u set everything in localmemory, but u never compare or call anything saved, u just save whatever is in the game which by default is 0 or default values u gave.

    order of reading events matters.

    also if u have another "on start of layout" above current one, might as well do a subevent under that ... but keep it under 20 actions or subevents... and give them time to load, before u do something.

    not sure if this got fixed, but i remember there was a issue with having to many actions and subevents in main event condition, and somewhere around 20-25 lines under same condition was were things started behaving weird.

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