IF two objects with the same var value exist -> action

0 favourites
  • 8 posts
From the Asset Store
Various Bell Sounds (from small to huge) / 35 Unique Clips / 2:46 minutes of audio
  • I don't understand why this didn't work, i want to do this: If two or more objects with the same variable value exist then action, i need to use families.

  • you could use something like

    1/ system pick by comparaison object fruits families when fruits.animationName= "Orange"

    • system compare two value fruits.pickedcount >=2 ---> Set text to "I like Oranges"
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • you could use something like

    1/ system pick by comparaison object fruits families when fruits.animationName= "Orange"

    - system compare two value fruits.pickedcount >=2 ---> Set text to "I like Oranges"

    Now Its Working, thank you!!!!! i learned something new today

  • Then wrap MadSpy answer in a for each.

    For each fruits

    +(empty sub-event)

    --Set local var currentFruit to fruits.animationName

    +Pick all fruits

    +Pick fruits where fruits.animationName = currentFruit

    +Compare two values : fruits.pickedCount >= 2

    --Do something

    --Stop loop

  • Lol I had prepared a little capx to show you the method (with local variable and pickedcount for the last)

  • Lol I had prepared a little capx to show you the method (with local variable and pickedcount for the last)

    thanks for the example but think if i have hundred of different fruits, i cant use local variables.

    i tried this again and now didn't work, the last object didn't update the Boolean, if i have two oranges or more i want to set the Boolean duplicated true but only to oranges or other duplicated objects, how this can be done? i cant use local variables because if i have a lot of objects in a family then will be a lot of local variables.

  • It seems that this solved your situation.

  • It seems that this solved your situation.

    No, the example below isn't worked

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