How do I save global variables? What am i doing wrong?

0 favourites
  • 9 posts
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • YES! I have read lots of topics about that, i also read manual and tutorial but i still can't do it.

    I need to save global variables for my android game.

    Could you please land a hand, what am i doing wrong or what is missing?

    It is simple, when you complete a level and it needs to be saved when you open the game later.

    I need it for all levels, without arrays if possible.

    This took my 2 days and still i fail.

    pic link if you cant open picture above; http://imageshack.com/f/iqcLLDzZp

  • you can use web storage,

  • Yes i do, at least i try to do but i don't know what i am doing wrong...

  • how about using the Save and load system

  • it is too simple for this game and it will be my last choice if i can not make what i have in my mind, i just need variables to be stored then loaded when player runs game again.

  • I don't know what your game is, but I think your game will resume to the last level you played.

    1.) You need a global variable which save the current level. (let's say the name is "CURRENT_LEVEL").

    2.) then, everytime the player complete a level, check whether CURRENT_LEVEL is greater than (your_webstorage_key) or not. If yes, then add 1 to CURRENT_LEVEL, and save it to (your_webstorage_key).

    3.) then, when your game is being opened, set CURRENT_LEVEL to (your_webstorage_key) to resume.

    Sorry for my bad english.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • and perhaps you need to learn "Progressive level selector". find it on google.

  • I don't know what your game is, but I think your game will resume to the last level you played.

    1.) You need a global variable which save the current level. (let's say the name is "CURRENT_LEVEL").

    2.) then, everytime the player complete a level, check whether CURRENT_LEVEL is greater than (your_webstorage_key) or not. If yes, then add 1 to CURRENT_LEVEL, and save it to (your_webstorage_key).

    3.) then, when your game is being opened, set CURRENT_LEVEL to (your_webstorage_key) to resume.

    Sorry for my bad english.

    Thank you, do i need to know about arrays? I think not. I will take a look at this

  • ok, goodluck then~

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