How do I automatically save game

0 favourites
  • 9 posts
From the Asset Store
20 high quality click sounds, ready to improve your game's UI instantly
  • I have title layout and game layout.

    When i run my game at start system should load game and when i finish game layout system should save state.

    Problem is when i set on start of layout 'load' game state this event will be looped at start of layout

  • You could create a "Loader layout" that will be the first layout of your project that will do the following:

    [On start of layout] Load game

    [On load failed] Go to 'TitleLayout' (if you play for the first time)

    Also, if you save in GameLayout loading the game will bring you to that layout, but I am sure you want to make it start from the Title screen so add this condition to every eventsheet:

    [On load complete] go to 'TitleLayout'

    In this way you can save anywhere at anytime, just remember not to set that condition to the TitleLayout event sheet

  • BouncyTrip that make sense i will try. Thanks

  • Hmm, i have a question about this. Im creating a game with a bunch of things that can be upgraded and unlocked. Right now im using webstorage to get this done. But there are like 50 different variables that needs to be saved here and there. Can i just use this way instead? Does it work for Android games?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It works perfectly, but pay attention to performance, because I saw that loading my game made everything slower and I had to revert to webstorage...

    ***UPDATE*** I've just read that some "save" bugs were fixed on R197.

    I reverted to webstorage when the last release was still R196, so I'll give a second chance to the save action , maybe those bugs were the performance killers.

  • You can also use the "Function" object to save all those variables in webstorage.

    give it a look:

    https://www.scirra.com/manual/149/function

    You just need to do the following:

    [Function | "savemygame"] : (save all the variables in webstorage)

    Then you can use that function as an action like this:

    [On tap on SaveButton] : (call "savemygame")

    The action (call "savemygame) will repeat all the actions defined in the [Function | "savemygame"]

  • Thanks BouncyTrip

    guess i'll stick to webstorage then. Good idea with using functions to save variables. Never thought about that.

  • DetteMan I'm gald to know I've been helpful

    Also, I'm not sure but It seems you have to copy the function in every event sheet that will require to call that funciton.

  • BouncyTrip your idea works well for me, thanks

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