What did I do wrong with the gold system?

Get help using Construct 2

Post » Sat Feb 21, 2015 3:09 pm

I'm trying to make my game save the current amount of gold and i followed a tutorial all the way but it still won't work. Does this event look right?
Local Key "Gold" Exists: Set Gold to WebStorage.LocalValue(Gold)

It's the same problem with my high score system. Thanks for help in advance!
B
12
S
3
Posts: 129
Reputation: 1,131

Post » Sat Feb 21, 2015 3:13 pm

Please can you tell us which tutorial followed?
B
226
S
31
G
14
Posts: 1,899
Reputation: 38,302

Post » Sat Feb 21, 2015 5:29 pm

Here is what you should do:
Local Key "Gold" doesn't exist (you can do this by right-clicking and clicking Invert): Set Local Key "Gold" to 0
Local Key "Gold" Exists: Set Gold to WebStorage.LocalValue(Gold) << You use these 2 events at the very start of the game.
Then throughout the game as the player is gaining gold, you set the local key value to the Gold variable (so that it is always being updated).
In other words, if you have an event that adds or subtracts gold, you also Set Local Key "Gold" to the gold variable.

Regarding the highscore system, at the start of the game place this event: Local Key "highscore" doesn't exist: Set Local key "highscore" to 0.

Then in the game's event sheet, add an event to check if the score variable is greater than the highscore local key. If true then set the local key to the score variable.

Hopefully that makes sense (I'm terrible at explaining things), tell me if it doesn't.
B
17
S
5
Posts: 46
Reputation: 1,107

Post » Sat Feb 21, 2015 6:11 pm

Message: firezombie444 is not yet permitted to post plain text URLS (300 rep required). 1 URLS removed. Why?
I used this one: and I did that but it still wont work.
B
12
S
3
Posts: 129
Reputation: 1,131

Post » Sat Feb 21, 2015 6:12 pm

it wouldn't let me post the url... it's in the Arcade Style High Score tutorial in the Scirra tutorials
B
12
S
3
Posts: 129
Reputation: 1,131

Post » Sat Feb 21, 2015 6:20 pm

Does it not work with free version?
B
12
S
3
Posts: 129
Reputation: 1,131

Post » Sun Feb 22, 2015 2:38 am

I replayed the tutorial again and now it says NaN where the high score is suppose to be. I'm working on the high score right now not the gold sorry.
B
12
S
3
Posts: 129
Reputation: 1,131

Post » Sun Feb 22, 2015 9:09 am

here I found this for you see if it can help you
You do not have the required permissions to view the files attached to this post.
B
226
S
31
G
14
Posts: 1,899
Reputation: 38,302

Post » Sun Feb 22, 2015 9:00 pm

I tried opening it and it takes me to the install Construct 2 screen (which i already did), is it suppose to do that?
B
12
S
3
Posts: 129
Reputation: 1,131

Post » Sun Feb 22, 2015 9:40 pm

No No No. Are you using free version?
B
226
S
31
G
14
Posts: 1,899
Reputation: 38,302

Next

Return to How do I....?

Who is online

Users browsing this forum: LaurenceBedford, Tackla and 6 guests