Saving options settings before a new game.

0 favourites
  • 3 posts
From the Asset Store
Kids Game
$49 USD
New Sounds Added Update: 115 new sound effects added for no additional cost!
  • I've been working on a title screen which contains a sub menu with options where the player can tweak various things like sfx/music volume and a couple of simple graphics settings before starting the game. I'm storing these settings in global variables. Only problem is, that when the user presses "new game" those global variables are all reverted back to their defaults (by design, as the game needs to do this), so once the game actually starts - whatever changes the user made on the title screen don't carry over. I'm just wondering what the best approach for dealing with something like this is - I'm guessing that saving those variables to an external file and then loading it in and checking it is probably the way to go - considering that I'm targeting Windows desktop - what would the best method be to do this and are there any potential problems I should know about when writing/reading back variables like that?

    Thanks for any insight!

  • You can create a group and add local static variables inside this group. These variables will not get reset, but will only be accessible by events from this group.

    Another solution is to create an object "Settings" (for example an empty sprite), set it as Global and add instance variables to it.

    If you want to keep these values between gaming sessions, you should save them into Local Storage.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks for the excellent suggestions. Ultimately I would like them to be saved between sessions so I will look into how to do it with local storage. The other methods are really clever too though and will probably come in handy at some point - thanks for the suggestions!

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