How do I Highscore template auto-runner

Get help using Construct 2

Post » Wed Mar 12, 2014 6:44 pm

Code: Select all
Set BestDistance to WebStorage.LocalValue("BestDistance") 

And
Code: Select all
Set local key WebStorage.LocalValue("BestDistance") to BestDistance 

Don't forget the quotes.
B
66
S
22
G
14
Posts: 1,484
Reputation: 16,511

Post » Thu Mar 13, 2014 1:14 am

I put the quotes but is still doing the same, for an instant the BestDistance is set to the totaldistance but then is reseted again to 0.

Image

Could be Reset global variables to default and restart layout the problem with this? i saw in a tutorial that sais, on start of layout, set time scale to 1.0... could be this the solution?
B
31
S
13
G
6
Posts: 355
Reputation: 5,058

Post » Thu Mar 13, 2014 1:50 am

Is it possible to see the rest of the code to see what is going on?? Everything looks right now. Let us see how you are tallying up the distance.
B
23
S
4
G
2
Posts: 364
Reputation: 2,392

Post » Thu Mar 13, 2014 2:14 am

Sure, its the same template auto runner is in the construct File>New.

Image
B
31
S
13
G
6
Posts: 355
Reputation: 5,058

Post » Thu Mar 13, 2014 3:18 am

Okay I loaded up and it worked for me you might what to make sure the text box is large enough cause if not it won't display correctly.

TextSample.png


ScoreCode.png


Also make sure you round up when you store the value. I forgot to do that.
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 » Thu Mar 13, 2014 3:22 am

Actually you know what you don't need the else statement. Remove it and remove the variable reset and layout reset in updating the Best Distance cause when it come out it will do it anyway.

Cleaner version::
CleanerVersion.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 » Thu Mar 13, 2014 4:35 pm

still don't know which is the bug... so your game update the bestDistance correctly right?

Im going to check at afternoon when i come back from the work.

Thanks for helping me :)
B
31
S
13
G
6
Posts: 355
Reputation: 5,058

Post » Thu Mar 13, 2014 7:01 pm

Yup you can see here::

https://dl.dropboxusercontent.com/u/128 ... index.html

I don't just give you the .capx because I don't want to stifle your learning. It will strengthen your bug detection. Now as I said earlier if you run it in different browsers the information doesn't transfer meaning you set a 'Best Distance' in Chrome. Then that is the Best Distance in Chrome open in IE or Firefox it would be zero out for them.
B
23
S
4
G
2
Posts: 364
Reputation: 2,392

Post » Thu Mar 13, 2014 7:34 pm

No wait, i think i know what is happening... when i created the textbox in one of the fields i think the text field that have writed text by default i put a 0 there maybe i should just leave it in blank.
B
31
S
13
G
6
Posts: 355
Reputation: 5,058

Post » Thu Mar 13, 2014 10:34 pm

ok now i get it.

The thing is i had set local key bestdistance to webstorage.localvalue ("bestdistance") and is set local key "bestdistance" to round(totaldistance).

But when i saw the tutorial on youtube they use webstorage.localvalue... which is the diference between both?

This works if the game is for android cell phones?

i think now im going to try the best 3 scores :P
B
31
S
13
G
6
Posts: 355
Reputation: 5,058

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 36 guests