Compare Family Variable

0 favourites
  • 3 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • Hi, I have a drag and drop setup which validates by checking a variable ("value") against the container variable of the same name.

    This works fine.

    However, the 'container' items can be different objects (bowl, cup, glass, etc), so I moved the variable to the family level:

    Family: Container // Property: "value"

    ==> Glass

    If I check the water.value = Glass.value it works fine. However, if instead I check against the family, the check fails:

    water.value = Container.value

    Is this expected behavior?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • sounds like a picking problem. If more than one of the "Container" objects is picked, then it will only compare the water.value to the first of the container objects unless you do a For Each container loop, or use some other method to make sure you are comparing to a single object.

  • sounds like a picking problem. If more than one of the "Container" objects is picked, then it will only compare the water.value to the first of the container objects unless you do a For Each container loop, or use some other method to make sure you are comparing to a single object.

    Thanks--I hadn't changed the filter for the drop event to Containers, so even though all the objects were of the family, it was picking them incorrectly?

    Before (not working):

    Water is overlapping Glass

    Water.value = Container.value

    Now (Working)

    Water is overlapping Container

    Water.value = Container.value

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