Reset all global variables vs included event sheets.

0 favourites
  • 5 posts
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • Hi

    Working on a project for a client, can't destroy it, hence the question.

    It has a main event sheet from where it includes a couple of other ones.

    And in the game over it reset all global variables and restart the layout, I don't see a problem with that.

    My question would be... When resetting all global variables, will it also reset the included from other event sheets?

    Will reset all global variables reset also dictionaries?

    Is there a better way to implement a PlayCounter?

    Thanks!

  • What specifically do you mean by PlayCounter?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What specifically do you mean by PlayCounter?

    Increment it each time the player enters GamePlay

  • I don't think you can pick and choose, it will reset all. Better way would be to just set them on restart and then you can ignore the game entry variable.

  • Reset Global Variables will reset all global variables in the entire project, even in not-included event sheets. If you want to preserve some value after the reset, there are a couple of ways to do this -

    • you can make a static local variable in an event group. Static local variables are not reset.
    • you can create an instance variable on a global object (array for example), or create a dummy object (empty sprite) and set it as global
    • store it in an array or dictionary
    • save in Local Storage
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)