Can't remember data after loading?

  • I've hit an interesting problem.

    I'm using a checkpoint system which involves using the 'save' and 'load' system actions. Basically, whenever you hit the checkpoint, the game saves, and whenever you die, the game loads.

    I'm trying to have a variable called 'RespawnTime' which records the amount of time since the last respawn. As such, it should set to zero on death.

    The problem is, global variables are reset to their previous value after a 'load' action, meaning it seems like there's no way to save any data or do anything when loading!

    Here's an example capx to show what I mean. If you hit the checkpoint then die, you respawn correctly. However, it seems as if the 'Set RespawnTime to 0' action in event 11 didn't do anything!

    Am I foolishly forgetting something, or is this indeed the interesting conundrum I think it to be?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Better off with dictionaries & webstorage :B

  • Tokinsom

    Webstorage might work with the no save behavior.

  • I meant not using the save feature at all ^^;

  • The 'Load' action can take a few ticks to complete. Anything done between the 'Load' action and the 'On load completed' trigger firing will probably be replaced by loading the game. You probably wanted to put that action in 'On load completed'.

  • Yes, I tried it, it works well after added an event 'On load complete' included an action 'Set Respawn Time to 0'.

    I think it means anything you want to do in game loading process, you should put it in 'On load complete' trigger event which followed 'Load' action, is that right?

  • Yep, I can confirm that 'On Load Complete' definitely works.

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