How to reset the global variable for layoutA but not layoutB

Get help using Construct 2

Post » Mon Oct 05, 2015 12:30 pm

Hi guys and girls :)

Is it possible to reset the global variable for a particular layout, but not for another? In my case, I would like to reset the global variable in when I restart a new game (after losing) , but not reset it for the high scores, so as one is able to save their latest score. The problem that I am having is that when I start a new game, while I do go to the correct layout, I am not getting the correct level title.

Here is a link to the game: https://www.dropbox.com/s/qtnasg3w0n1sku8/unstacker.capx?dl=0

Thanks to everyone in advance :)

Christa
B
5
S
1
Posts: 36
Reputation: 451

Post » Mon Oct 05, 2015 1:22 pm

As the naming suggests "global variable" is global. So you cannot treat it separately for various layouts - it is global for entire projejct.

If you want to do a kind of global variable for the particular layout, you may do a "global" groupd in event sheet assigned to the layout and set static variable for this group. It will be visible for all subgroups as well but not for other layouts.

Another thing is that for high scores you may want to use LocalStorage.
ImageImageImage
B
32
S
19
G
82
Posts: 1,039
Reputation: 46,232

Post » Mon Oct 05, 2015 3:35 pm

Makes sense.. Thought it was something like that, but needed to be sure. However I have found a potential solution, by clearing up the global variable when I start the game, since I won't need it anymore at that time.
B
5
S
1
Posts: 36
Reputation: 451


Return to How do I....?

Who is online

Users browsing this forum: max2612 and 19 guests