[SOLVED] How do I retain global variable values on other layouts?

0 favourites
  • 4 posts
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • Hi guys, quick question:

    I have two global variables for layout Game:

    shredCounter = 2

    zeroCounter = 5

    When I load the EndGame layout, to end the game, I'm trying to retain the values, but it seems if I call use these variable from the previous layout, the value has reset to 0 and didn't retain the values of 2 and 5. Given they are global variables, why doesn't the EndGame layout retain the values? And how can I fix it?

    Thanks,

    Brandon

  • It should retain the values, my guess is your End Game layout is using an event sheet which has logic 'on start of layout set global variable to 0' or 'reset global variables'. Did you add any logic like this?

  • It should retain the values, my guess is your End Game layout is using an event sheet which has logic 'on start of layout set global variable to 0' or 'reset global variables'. Did you add any logic like this?

    No I did not, which is strange. The only place Global Variables are declared are in the first layout "Game". Do you think I need to re-declare the variables for the 'End Game' layout? I'm quite stumped.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I figured it out, I think. I duplicated the Layout instead of creating a new one from Scratch. I'm guessing the duplicate process messed something up. Anyway, thanks for the advice :)

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