My global variables aren't resetting?

0 favourites
  • 7 posts
From the Asset Store
Globals 2.0
$3.60 USD
10% off
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • Im trying to reset the game once player loses all lives. This should be very simple to do but im not sure why my global aren't resetting after the player dies and leaves the layout. I even tried to see if it resets without going to a new layout afterwards so I can see what coding is affecting this but nothing resets.

    I only have this event to reset the game and all the variables. Everything else works but that.

    And this is how it looks on start of layout. There's not many globals either so im not sure why it's not working.

  • I answered my own question after looking at the pics closely myself. The globals are resetting, it's the "Game" sprite variables that aren't resetting. How do I reset that?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just a clarifying question - is all that code supposed to be part of the function "GoToNextLevel"? Or is it meant to run every tick?

    It looks like it's running every tick, because it's not a subevent of the function. But it seems like you want that code to only run when the function is called?

  • No, the "GoToNextLevel" Function is on it's own. The Code underneath it is it's own thing for the player resetting the game when the player(s) dies. I just have that there to work on down the road after I get the reset done.

  • Did you add the the persist behavior to the Game object? Under normal circumstances instance variables should automatically reset when you change the layout.

  • birdboy

    Thanks for your concern. I have found what's going on now. My player's life points is recorded in a "key" and so when I do restart the game, the life of it still shows "0" even though it had reset "code wise" because it's in a memory "key" and the last number it reached was 0. So it's working and the reset of the global works. It was that, that was throwing me off and made it look like nothing wasn't resetting.

  • I fixed the issue. Thanks everyone

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