How do i save global varibales

0 favourites
  • 12 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.
  • I am making a mobile game similar to zombie dash which i am going to publish on android market. It has a working coins and store system, only whenever i exit the game and re open it the upgrades and coins are gone. I am storing the Coins in global varibales, and the upgrades in global varibales also. I need to know how to save these so that when someone reopons the app, they have the stuff that they had before. All help is apprecitated! Also this is my first game i am making by myself, and it has a lot of features! Its pretty complex :L also could someone post a link to a guide on how to put ads on mobile games? <img src="smileys/smiley1.gif" border="0" align="middle" />

  • You need to save them locally.

    For example,

    System.OnEndOfLayout

         ->WebStorage.SetLocalValue{SavedCoins(GlobalVarName)}

    The set the GlovalVariable to LocalStorage.GetLocalKey{SavedCoins}

  • You'll need to set the variable to the local get key on start of layout <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Thank you very much! Wasent expecting such a quick anwnser and in such deatail :D I hope evreyone in this forum is as nice as you :D

    I'll go and try that now, <img src="smileys/smiley4.gif" border="0" align="middle" />

  • No problem, Let me know if you need a demo capx.

    This is a very friendly forum, with some really smart users.

    Welcome to C2! <img src="smileys/smiley31.gif" border="0" align="middle" />

  • i done this and when i fully close the app and open up again it resests the coins. this is what i put in. http://www.flickr.com/photos/75639987@N06/6796496909/in/photostream Point me to what im doing wrong? :L Apart from that i have the global varibal Coins. Sorry to be such a nuisence!

  • Please post your capx for us to see whats wrong.

    Also, if you need to target a question at a specific user add a and then there name, It sends us a notification.

    for example smitchell

  • Capx=Project in construct 2 right? Oh and btw i followed your game shop tutorial thanks for that :D Or do you mean the .caproj file? Becuase im new and im not sure! :L Thank you for helping me out so much. And btw i cant use dropbox, so i will use fileslap which is allright. thanks for helping.

  • File -> Save as single file. that will save your game as a capx.

    You can upload the whole caproj but a capx is a zipped caproj. and its easier for you to upload a capx onto dropbox or something similar then i can download it easily.

    Your welcome on the tutorial. In that tutorial i actually showed how to save and load a variable, Have you tried following that?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • http://minus.com/mupLFL3uL There you go on level event sheet at the bottom is were the problem is. Thanks!

  • Here you go: http://dl.dropbox.com/u/51270524/ZombieFixed.capx

    The problem was you was trying to save SavedCoins as "Coins", when referencing a global variable you are not supposed to place it in quotation marks.

  • Thanks very much :D

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