How do I Highscore template auto-runner

Get help using Construct 2

Post » Wed Mar 12, 2014 2:07 pm

Hi guys im tryting to add a highscore to the template auto-runner so i added a new textbox in the middle called BestDistanceDisplay.

When the player died i set to the bestdistancedisplay textbox the text of totaldistance, but then all the global variables goes to default and the layout is restarted, same thing happen with the text inside bestdistancedisplay.

So, mi question is... how can i maintain the value in bestdistancedisplay textbox for every game?
B
31
S
13
G
5
Posts: 355
Reputation: 4,558

Post » Wed Mar 12, 2014 2:24 pm

B
39
S
15
G
5
Posts: 295
Reputation: 6,089

Post » Wed Mar 12, 2014 4:47 pm

As @Joskin pointed out you can use webstorage. You can also use the savegame system if you don't want to mess with webstorage. There are many options. It just depends on what you want to store/
B
49
S
12
G
10
Posts: 1,833
Reputation: 14,573

Post » Wed Mar 12, 2014 4:55 pm

Thanks for the help Joskin.

I added the webstorage and the variable always resets, what i'm doing wrong?

Image

could be the reset of flobal variables or the restart layout?

Thanks for your help :)
B
31
S
13
G
5
Posts: 355
Reputation: 4,558

Post » Wed Mar 12, 2014 5:02 pm

One thing I notice is that it isn't comparing if the TotalDistance beat the BestDistance. It automatically set the bestDistance with the TotalDistance. So regardless if they beat it or not the TotalDistance overwrite the BestDistance.

The only problem with the Webstorage is that it isn't consistant if you wanted it to be a webgame. The best way someone explained it to me is Webstorage is kind like cookies. So for me it didn't work as planned being that I wanted to host the game on my webspace and people can play and try to beat each other score. But it doesn't work that way. I was told to integrate clay.io
B
23
S
4
G
2
Posts: 364
Reputation: 2,392

Post » Wed Mar 12, 2014 5:14 pm

Also why isn't it Italicized here??
Untitled.png
You do not have the required permissions to view the files attached to this post.
B
23
S
4
G
2
Posts: 364
Reputation: 2,392

Post » Wed Mar 12, 2014 5:19 pm

I see it now. You are just putting the value of the webstorage back into itself its suppose to be set Local key BestDistance to global variable BestDistance.
B
23
S
4
G
2
Posts: 364
Reputation: 2,392

Post » Wed Mar 12, 2014 5:26 pm

Not every game needs a webspace based score system. I also see the issue in the missing part of checking if the new score is higher than the highscore.
B
10
S
2
Posts: 135
Reputation: 1,090

Post » Wed Mar 12, 2014 5:27 pm

Yea I was just stating in case that they were heading that route and be like me and be like...umm its not working how I intended. Best to know now then develop and find out later. So if that is what they are planning to do they already know.
B
23
S
4
G
2
Posts: 364
Reputation: 2,392

Post » Wed Mar 12, 2014 6:12 pm

like this? is still not working :(

Image
B
31
S
13
G
5
Posts: 355
Reputation: 4,558

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 4 guests