how save the settings in a game

Get help using Construct 2

Post » Mon Feb 10, 2014 12:55 pm

I have a problem. I dont 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!!! ;)

B
17
S
5
G
2
Posts: 173
Reputation: 2,085

Post » Mon Feb 10, 2014 1:13 pm

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: https://www.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.
B
44
S
10
G
8
Posts: 437
Reputation: 6,468

Post » Mon Feb 10, 2014 1:57 pm

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.
If it can be done, someone on the web will show you how to do it!

CDASI Games Mentality Break Splat-a-bug FlapFleet Challenge
B
35
S
13
G
7
Posts: 363
Reputation: 7,283

Post » Mon Feb 10, 2014 3:52 pm

@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!! :)
B
17
S
5
G
2
Posts: 173
Reputation: 2,085

Post » Mon Feb 10, 2014 10:40 pm

@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.....
If it can be done, someone on the web will show you how to do it!

CDASI Games Mentality Break Splat-a-bug FlapFleet Challenge
B
35
S
13
G
7
Posts: 363
Reputation: 7,283

Post » Tue Feb 11, 2014 8:22 am

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
B
17
S
5
G
2
Posts: 173
Reputation: 2,085

Post » Tue Feb 11, 2014 10:04 pm

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.



If it can be done, someone on the web will show you how to do it!

CDASI Games Mentality Break Splat-a-bug FlapFleet Challenge
B
35
S
13
G
7
Posts: 363
Reputation: 7,283

Post » Wed Feb 12, 2014 9:12 am

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 dont like me because dont flow nice, any idea?

I am fixed collision polygons too :)

Thanks very much for your advices and your help!! ;)Tarkion2014-02-12 09:12:30
B
17
S
5
G
2
Posts: 173
Reputation: 2,085

Post » Wed Feb 12, 2014 12:16 pm

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....
If it can be done, someone on the web will show you how to do it!

CDASI Games Mentality Break Splat-a-bug FlapFleet Challenge
B
35
S
13
G
7
Posts: 363
Reputation: 7,283

Post » Wed Feb 12, 2014 6:06 pm

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!!
B
17
S
5
G
2
Posts: 173
Reputation: 2,085

Next

Return to How do I....?

Who is online

Users browsing this forum: Congrats2u and 27 guests