Private Variables

This forum is currently in read-only mode.
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Just wondering if its possible but are you able to have family variables??

    e.g. I have an object that when I want a variable changed it changes the same with the whole family

    Family Variables not local or private

  • If you want the entire family's variable to change you will have to create an event that does that. You can change an entire family's variables at once by performing the "Set value" action on the family instead of each object within it.

    To set up variables for whole families at one time in the Layout editor you can use the Manage Families button at the top located under Project.

    And of course, you could always have your family set it's variables to those of a specific object within that family by using events. So if "objA" is in the Blue family, you could do this:

    +Always
      -> Blue: Set 'myVar1' to objA.Value('myVar1')
      -> Blue: Set 'myVar2' to objA.Value('myVar2')
    
    etc.[/code:gm3gjx9q]
  • yeah thats where my problem is.

    Its because i want every member of the family to be able to change the variable so letting one member in charge is not what i want

  • Perhaps you could be more specific. What exactly are you trying to do?

  • Do you mean you want all members of the family to have their variables changed at the same time? In that case do this:

    +For Each (Family Name):

    -Set Family('value') to 10

    I hope that's what you're looking for.

  • i mean a bit like this

    3 objects in a family

    They all share 1 variable

    The variable number is zero

    object 1 adds two and object 2 adds three

    making the variable 3 for all the objects

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I don't think you can do it like that. You'll have to have an intermediary variable somewhere that you can add the family values to. Like a global, or a non-family object. Then you can move that number back into the family variable.

    At least, I can't make it work. I've tried for the past 20 minutes or so with no luck.

  • ok thanx anyway i hope they make the next few builds have family varkiables like that though

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