How to reset the global variable for layoutA but not layoutB

  • 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

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)