How do I saving time or score when < then highscore ?

Get help using Construct 2

Post » Wed Jun 04, 2014 8:00 pm

hi,
iam trying saving time score in webstorage but not work (with score < then highscore)
any help please ?
thanks
B
45
S
16
G
8
Posts: 792
Reputation: 8,306

Post » Wed Jun 04, 2014 9:14 pm

Use compare two values when you save the highscore to confirm that score > highscore
B
46
S
14
G
7
Posts: 603
Reputation: 8,096

Post » Thu Jun 05, 2014 2:41 am

i use compare variable ... but in this case the score should be < than high score and not >
because i use time and the lowest time is better , you understand me ?
B
45
S
16
G
8
Posts: 792
Reputation: 8,306

Post » Thu Jun 05, 2014 6:13 am

okay then switch it to less than instead of greater than?
B
46
S
14
G
7
Posts: 603
Reputation: 8,096

Post » Thu Jun 05, 2014 12:11 pm

i switch it to less than the result is that not save the high score and always set it to zero
try it by your self
B
45
S
16
G
8
Posts: 792
Reputation: 8,306

Post » Mon Jun 09, 2014 7:52 pm

when i try to save on webscore when score is < than high score it not save .... thats problem (its save only when it is score > high score) ... and in my case i need to save time and the the lowest is better ....
B
45
S
16
G
8
Posts: 792
Reputation: 8,306

Post » Tue Jun 10, 2014 2:36 pm

Maybe an example will help.

Commented example capx: StopGo.capx (r168)

When you press "GO" it sets your score to 0 and starts counting up (based on dt * 1000).

When you press "STOP" it stops adding to your score and compares that to your best score.

If your current score is less than your best score, it saves that as the best score in webstorage and updates the display.

The "Best Score" starts out at a high value, until a better score is made/saved.

If your game still isn't saving, you might need to share your capx (can use dropbox.com) so someone can test it and see what's going wrong.
Vote for all the Construct 2 games on Steam Greenlight - Find them here
B
32
S
9
G
7
Posts: 444
Reputation: 6,731

Post » Wed Jun 11, 2014 3:15 am

OddConfection wrote:Maybe an example will help.

Commented example capx: StopGo.capx (r168)

When you press "GO" it sets your score to 0 and starts counting up (based on dt * 1000).

When you press "STOP" it stops adding to your score and compares that to your best score.

If your current score is less than your best score, it saves that as the best score in webstorage and updates the display.

The "Best Score" starts out at a high value, until a better score is made/saved.

If your game still isn't saving, you might need to share your capx (can use dropbox.com) so someone can test it and see what's going wrong.


one word i want to say you ... THANKS A LOT

with some modification thats work ... at first i dont understand why you add the ("best_score") , i understand that is just value ... and now work like charm

sorry for my bad and poor english :)
B
45
S
16
G
8
Posts: 792
Reputation: 8,306

Post » Wed Jun 11, 2014 10:11 am

@matrixreal - You're welcome. I'm glad you got it to work.

Sometimes it's easier to work out from an example than a description.
Vote for all the Construct 2 games on Steam Greenlight - Find them here
B
32
S
9
G
7
Posts: 444
Reputation: 6,731

Post » Thu Jun 12, 2014 5:17 pm

yes just one thing ... when i quite the game ... and relunch it again
that not save the highscore :( that save it only when iam on game , if i close it and relunch it again that not work
B
45
S
16
G
8
Posts: 792
Reputation: 8,306


Return to How do I....?

Who is online

Users browsing this forum: SputnikCZ and 3 guests