How do I save only global variables

Get help using Construct 2

Post » Wed Mar 19, 2014 8:01 am

I have auto saving in my game but at the moment it currently works like this:

-first layout loads game and sets a load variable.
-it loads the game where it saved at the end of a level and with load variable on it takes you to the main menu.
-main menu takes the load variable off.

The problem I have is I can get some weird errors when doing this aswell as random sounds playing in the main menu screen.

Is there a way to not save game state but to just save global variables as they are and then load the global variables on start up?
B
12
S
4
G
1
Posts: 137
Reputation: 1,519

Post » Wed Mar 19, 2014 8:09 am

The only way is to use web storage to save variables's values. When you reload the game, load web storage values and put them in the global variables, then set the game based on your global variables.

Some useful links for you:
https://www.scirra.com/manual/120/webstorage
https://www.scirra.com/tutorials/266/we ... nformation
B
24
S
4
G
2
Posts: 41
Reputation: 1,543

Post » Wed Mar 19, 2014 12:33 pm

Awesome I replaced my shoddy save code with webstorage with global variables and my project works a lot better.

Thanks for the reply.
B
12
S
4
G
1
Posts: 137
Reputation: 1,519


Return to How do I....?

Who is online

Users browsing this forum: Julot135, Magistross, Yahoo [Bot] and 22 guests