Save/load function

  • Hello everyone,

    I have a webstorage save system on my game to save the global variables. But now, I'm trying to use the load/save function in order to include a lot of collectable bonus that keep their stat without a global.

    Everything works pretty fine but I still have some issues that disturb me:

    -The played music is saved by that function. So when I load the samegame I have the music (and the sounds) that were playing at that time. It's like a quickload. I can't find a way to avoid that. Even a 'stop' music doesn't work.

    -Same with the post FX. I have global variables to check if it's fullscreen or not. But when I change the option on the main menu and load the game, he keeps the global as it was before (even if I load the webstorage data AFTER the Load function)

    So my question is : Is there a way to block some data (globals; sounds) during a SAVE function, like the objects with the 'NOSAVE' behavior.

    Thanx

  • It doesn't work if you stop all sounds and music before the initial save takes place?

  • plinkie Well I save the game when the character overlap an object like a checkpoint. So I can't cut all the sounds; the player is still playing.

  • Maybe stop the sounds in a "load complete"-event.

  • mindfaQ Good idea. But no... it doesn't stop anything. :(

    I also don't understand something:

    1)I play and catch some bonus. Then I save.

    2) I close and relaunch the game. The music continues(not as expected) and the bonus are disappeared (as expected).

    3) I close again and relaunch : The music starts from the beginning and the bonus are back !!!!!!!!!! WHAT THE HELL ?

    It's like if my full save was deleted after 2 launches.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I've just done this very easily. All you need is : -

    On Load Complete

    Cond: If any audio is playing > Stop All

    Essentially what the guy above me was saying to do as well.

  • It doesn't seem to work on my project because I load the savegame on a 'loading layout' and then go to the layout written in a global.

    Adding this stopall function on the loading layout eventsheet or the game eventsheet give the same result : music and sounds still playing.

  • The audio plugin has settings for what audio is saved and loaded.

  • I don't understand the crazy load game method. Link to a demo of the game so I can see how it saves/loads please.

  • Ashley Thank you! That's what I was looking for. Is there a way to tell a Global variable not to be saved ?

  • KaMiZoTo

    you have to redesign your savegame option because the save/load is like a "save state" similar to emulators (i know, and i dont like it too)

    so check points is not a good thing to do for save, thats why some games like castlevania and super metroid have save rooms without music playing

    what you can do is make a save room without music and make a simple menu with a event to prevent the player from moving; you can still have check points but try not to use then as save/load options, use just to keep a location for 1 section of play.

    now for the bonus, you have to make a check if the player already have it and destroy the one showing on the background/map

  • Currently everything is saved except things with the 'no save' behavior. It's not elegant, but a workaround is to back up any global variables to instance variables in a 'no save' object, load, then restore the globals from the instance variables afterwards.

  • valdarko I already have a saveroom. The music issue is solved thanx to the audio plugin options. So it works.

    But I'm still wondering how we can have game options with that 'save stat' system. If the player decided to change an option on the title screen menu, it will be overwritten by the load state. It seems to be a deadend.

    I have a webstorage classic savegame. But if I want to deal with 500 bonus and check their stat, I have to deal with 500 global variables. (Am I wrong?)

  • KaMiZoTo

    maybe you can use the dictionary to handle this number of bonuses and check then

  • valdarko Mmmm yes perhaps dictionary can be a solution. But I never used one and don't know how it works. How would you proceed to check the stats of instance objects with a dictionary ? (If you don't mind of course!)

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