How do i save global varibales

Get help using Construct 2

Post » Mon Jan 30, 2012 9:09 pm

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?
B
5
Posts: 7
Reputation: 317

Post » Mon Jan 30, 2012 10:11 pm

You need to save them locally.

For example,
System.OnEndOfLayout
     ->WebStorage.SetLocalValue{SavedCoins(GlobalVarName)}

The set the GlovalVariable to LocalStorage.GetLocalKey{SavedCoins}
B
29
S
12
G
7
Posts: 740
Reputation: 7,839

Post » Mon Jan 30, 2012 10:11 pm

You'll need to set the variable to the local get key on start of layout
B
29
S
12
G
7
Posts: 740
Reputation: 7,839

Post » Tue Jan 31, 2012 4:10 pm

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,
B
5
Posts: 7
Reputation: 317

Post » Tue Jan 31, 2012 4:29 pm

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!
B
29
S
12
G
7
Posts: 740
Reputation: 7,839

Post » Tue Jan 31, 2012 5:12 pm

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!
B
5
Posts: 7
Reputation: 317

Post » Tue Jan 31, 2012 6:40 pm

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
B
29
S
12
G
7
Posts: 740
Reputation: 7,839

Post » Tue Jan 31, 2012 7:02 pm

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.
B
5
Posts: 7
Reputation: 317

Post » Tue Jan 31, 2012 7:14 pm

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?

B
29
S
12
G
7
Posts: 740
Reputation: 7,839

Post » Tue Jan 31, 2012 8:03 pm

http://minus.com/mupLFL3uL There you go on level event sheet at the bottom is were the problem is. Thanks!
B
5
Posts: 7
Reputation: 317

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 22 guests