How to increase the total score

Discussion and feedback on Construct 2

Post » Sun Apr 09, 2017 11:51 pm

someone tell me how to make the score of the separate layer from the total score. namely that the level of the score when I completed Success is in addition to the total score and if I lose the gained score is not going to add to the total score. I tried the total score on the forum, but not as an explanation for what I look for. I do not want the total score is replaced, for example, while I gain level 5 coins and the total score I have 10 coins I earned are added to the score becoming Toale 15 how do I make it happen?
ps. sorry for my english
B
14
S
7
Posts: 17
Reputation: 1,238

Post » Wed Apr 12, 2017 3:16 pm

use global variables.

Layout1score
Layout2score

when playing on Layout1, tally the score and save it to Layout1score
when playing on Layout2, tally the score and save it to Layout2score

Since the variables are global, all layouts know about these variables throughout the game and they are preserved as long as you don't 'reset all global variables'. Now you can add these scores wherever you need to.
B
98
S
32
G
16
Posts: 1,204
Reputation: 16,715

Post » Wed Apr 12, 2017 7:08 pm

I've tried but I have to make sure that the money I earned in level as "Layout1" with "coin" variable if the level is not completed the money is not saved. If completed the money "coin" to be saved nela global variable "total coin" and the "coin" variable is reset
B
14
S
7
Posts: 17
Reputation: 1,238

Post » Wed Apr 12, 2017 7:28 pm

you must have some way to know that the level wasn't completed right? Make that part of the condition System->OnEndofLayout
B
98
S
32
G
16
Posts: 1,204
Reputation: 16,715

Post » Wed Apr 12, 2017 7:50 pm

but then how do I make sure that if I compleato the variable "coin" level is saved in the "total coin" variable and the "coin" variable to zero. for example I gain 10 "coin" I completed the level 10 coin are earned in total coin and the coin are reset do not know what I mean?
B
14
S
7
Posts: 17
Reputation: 1,238

Post » Wed Apr 12, 2017 8:27 pm

how do I add the variable "totalcoin" the value of the "coin" variable and save it with local storage. Because then I have to reset the coin variable.
B
14
S
7
Posts: 17
Reputation: 1,238

Post » Wed Apr 12, 2017 10:32 pm

make an interim variable.

LevelCoins

GameCoins

TotalScore
B
98
S
32
G
16
Posts: 1,204
Reputation: 16,715

Post » Wed Apr 12, 2017 10:37 pm

I did so and it works but when I go out and return from the game do not save maybe I did something wrong in the local storage?
how can I send a screen here?
B
14
S
7
Posts: 17
Reputation: 1,238


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 12 guests