Battle and save state ?

0 favourites
  • 4 posts
From the Asset Store
State Machine
$10.99 USD
State Machine is a great tool for managing the state of anything in your game.
  • Here my idea there two layout one for the dungeon crawling and the second one for the rpg turn based battle.

    What Id like to do is to save the state of the prievous layout but when the battle is over id like to not only load the saved layout but also update the current variable such as Hp mana and item usage ?

    And question will the on start of layout function counter act the load as in another on start event happens or can i do a control check of keeping that First time game loads from game start to never load again ?

    Am i doing this part wrong ? or is layout the best or what ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Global variables are persistent and can be referred to in any layout.

    The persist behavior can be used to save or keep track of objects' information while switching back and forth between layouts.

    Arrays are also persistent through layout changes and are an excellent way to keep track of structured data.

    On start of layout will occur any time that layout loads. If you want it to run once only, use a variable (for example a boolean called "FirstLoaded"), add a second condition to your start of layout event to check if "FirstLoaded" is false, and add an action in that event to set "FirstLoaded" to true. After running the first time, the variable will be true and that event will never run again even if the layout start triggers again.

  • oh nice i never thought of that boolean trick. To my understanding global variable cannot be a boolean ? will i have to slap it on to a global sprite ? and also what would be a good way to put this under ?

  • Oh sorry you're right, you can't make a global variable boolean. In that case just make it a number and add 1 to it.

    Variable = 0
    
    On Start Layout   |  Action - Do Something
    If Variable = 0   |  Add 1 to Variable[/code:8nymgku8]
    
    Now that Variable is 1, that event will no longer run again even if you come back to your layout a second time. Unless you reset Variable to 0.
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)