0 Favourites

How do I pass family variables from a Layout to another

  • 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

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • 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

  • 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)
Similar Topics Posts Views Last Post
Unread hot topic
99 10,158
karshinkoff's avatar
karshinkoff
Unread hot topic
132 29,608
chadorireborn's avatar
chadorireborn
Unread hot topic
52 8,563
BluePhaze's avatar
BluePhaze