How do I keep all scores in smarter way?

Get help using Construct 2

Post » Thu Dec 18, 2014 8:28 pm

Since I'm going to need to store several scores, global variable won't be a good choice. So I thought using instance variable from a sprite. However, I don't know if this is the best Idea to safely store such an important thing in the game. Fundamentally is it ok? Or is there another way?
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

Post » Thu Dec 18, 2014 11:23 pm

I would use an array or a global dictionary. Probably a dictionary.

https://www.scirra.com/manual/140/dictionary

If you want it to persist, grab it's data AsJSON when it changes, and store it in a webstorage key. Then recall it when the game first starts (you can set a dictionary from JSON).

https://www.scirra.com/manual/120/webstorage

Global dictionaries can also be a good alternative to global variables in certain cases. Just FYI.
Don't lose your work. Backup your game with Dropbox.
B
44
S
10
G
10
Posts: 1,106
Reputation: 9,202

Post » Fri Dec 19, 2014 1:00 am

@TiAm

Thanks. I will study about this.

Edit: @TiAm I'm sorry but could you explain better how to use Global dictionary, WebStorage and asJSON? I didn't use it yet so I'm a bit confuse.
B
56
S
21
G
3
Posts: 602
Reputation: 6,612


Return to How do I....?

Who is online

Users browsing this forum: 25games and 32 guests