How do I pass family variables from a Layout to another

0 favourites
  • 6 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • Hi there,

    I'd like to use in Layout B family variable generated in Layout A but it seems changing layout resets them.

    Any idea on how to do that ?

    Thanks for the answer

    Laurent

  • Hi there,

    I'd like to use in Layout B family variable generated in Layout A but it seems changing layout resets them.

    Any idea on how to do that ?

    Thanks for the answer

    Laurent

    I'm fairly certain you have to use global variables if you want to carry variables between layouts.

    You could set a global variable that sets the family variable so that when the new layout starts it still applies it to the whole family.

  • izicial

    Thanks, that's what I thought.

    How do you do that ? I have 10 members in my family and 2 family variables?

  • izicial

    Thanks, that's what I thought.

    How do you do that ? I have 10 members in my family and 2 family variables?

    This capx shows when you press space bar it adds to the global variable. This in turn changes the family variable to = the global variable.

    So change any events that change your family variable to instead change the corresponding global variable then in the same event make family variable = global.

    Then when you start a new layout simply have the global variable set the family variable.

    EDIT: The complexity of this will be determined if you need a variable for all 10 of the family members or not, if they are all different and need to be carried over then you need to setup global variables for all of them.

  • Thanks izicial,

    10 sprites are inside my Family and the Family has 2 variables (Life and Mana). So every sprite has it own Life and Mana that evolve throough the game. These are the 10 Life and 10 Mana I want to pass from one Layout to the next

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks izicial,

    10 sprites are inside my Family and the Family has 2 variables (Life and Mana). So every sprite has it own Life and Mana that evolve throough the game. These are the 10 Life and 10 Mana I want to pass from one Layout to the next

    Oh if they ALL have there own separate values you could just forget the family values and run it all straight off Global variables and take away some of the confusion.

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