0 Favourites

how save the settings in a game

  • I have a problem. I don?t know how to save the setting the player want in a game: difficulty, etc...

    I have maked a capx but really is that I have no idea how do it...

    Thanks in advance!!! ;)

  • Maybe someone else can help you better right now, as I don't have C2 available right now, but the easiest way to save and load settings is by using WebStorage: scirra.com/manual/120/webstorage

    All you need to do is saving the settings and when you load the game, you can just load them again.

  • Tarkion,

    Here is a SavingData capx to show how to save and retrieve data with WebStorage.

    I modified your capx. I am using C2 R159. Hope this helps you out.

  • Ubivis thanks for your help :)

    michael a lot of thanks for your help and for the modifications you have done in the capx file. Now I understand how works!!! ;) Also thanks for your example and your advices about the use of functions!! :)

  • Tarkion, no problems, glad to help.

    Functions are excellent, once you start using them, you will wonder how you did stuff without them. You can read up on them here.

    Happy game creating.....

  • Hello michael ;)

    Yesterday in my main project did not worked once I added another subevent and global variables: volumen sound, mode play (arcade, hardcore, mix), ect... but today I think works... Here is your capx modified, do you think is correct? I need study a lot of I think jajajja

    Thanks a lot for your help!!

    Nice day all C2 creators!!

    Pd: I am trying to get examples of functions so I will see more easily how integrate in my projects with C2 :)

    Sorry my bad english lol

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Hi Tarkion,

    It all works fine my end. Is it working for you now?

    Couple of things I would change:

    1) The ModoPlay events could just follow the ModoMode events. So instead of having two 'On Start Of Layout' events you could have just one, that way you can save an event...

    2) I wouldn't put the volume text in an EveryTick event...

    However, the way it is now works....

    Couple of side points.

    I noticed the collision polygons for your buttons are bit weird. So if you are having difficulty selecting them you can take a look at that. I usually make my button polygons square.

    Sometimes you have to clear the browser cache, so new stuff works properly - this is especially true of IE.

  • Hello michael,

    yes, works for me!! I have changed some things. I have all modes in the same'On Start Of Layout' event and I have put volume text in a 'Every Second' although the result don?t like me because don?t flow nice, any idea?

    I am fixed collision polygons too :)

    Thanks very much for your advices and your help!! ;)

  • Hi Tarkion, sorry for not getting back sooner, has been a long day.

    Sounds like you have got the idea.

    With regard to Vol_Music text, I would just change it so it is updated only when you retrieve the setting, or when the user changes the volume.

    I had a play around and changed the example (SavingDataRevised) to tidy it up a bit, and to show you how I go about things.

    Hopefully it gives you some useful information and practices. I hope I commented the capx enough, but if you need any further help I will be happy to explain it a bit more....

  • Hi michael,

    I like very much so changes and improvement in the capx. Really I need to get more tidy with the way I use C2   :)

    The way you use the function is fantastic... I take note of all of details: name tabs, nomenclature (how use the pref 'gv' to kick access windows...) and how do you use the functions to make all organized... nice!!

    I have changed all in my project and works fine!!! :)

    lol, I would like talk to you 10 days ago, but now my main project is chaotic!! jajaja but it is more constructive like this...

    Thanks very much again michael!!

    Pd: your comments pefect!! <img src="smileys/smiley32.gif" border="0" align="middle" />

  • Hi Tarkion, you are most welcome.

    Organisation, naming conventions, and good commentary are very important in any programming language, because it will help when you go back to edit things later. Especially if you haven't worked on it for some time!

    However it is very much a personal thing too. So find a format that suits the way you work, and follow it in all your projects.

    The way I showed you is just my preferred method. Others on the C2 forums may do things differently, but that is one of the cool things about creating software - to a large degree you can find a method that you feel comfortable with, and as with all things we learn from fellow developers as well.....

    Happy to help, and happy game creating!

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