[BUG] Containers do not allow for the existence of families.

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

    C2 appears to detect that an object is part of a container and limits any events on that object to objects in that container, but it doesn't pick it up if the object the event on is part of a family.

    I was writing a simple control that has a number, a + above it and a - below it. The idea is that the number is adjusted using the +/- buttons. I created a family Adjuster with an instance variable 'adjustAmount', which has two objects in it, AdjustUp and AdjustDown with the adjustAmount set to 1 and -1 respectively.

    The text object with the number is a container containing an adjustUp and an adjustDown instance.

    The original version (Layout 2) uses a single event to detect a touch on a member of the Adjuster family. The action is to add the adjustAmount in the Adjuster subclass to the boxValue in the Value object, and update the display.

    However, the "Value" is not limited to the one in the Container with the Adjuster object but is the whole collection of such objects , so clicking on an Adjuster causes all values to change.

    Layout 1 is identical save that there are two events, touch on AdjustUp and touch on AdjustDown , this works as intended.

    Attach a Capx

    .... how ? Can't see any upload button <img src="{SMILIES_PATH}/icon_e_sad.gif" alt=":(" title="Sad">

    I've uploaded it to http://studio2.org.uk/ContainerBug.capx

    Description of Capx

    Layout 1 and 2 are identical apart from the event detection on the +/- text items. The idea is that the +/- should only adjust their own value.

    Steps to Reproduce Bug

      Compare Layout 1 (works) with Layout 2 (fails)

    Observed Result

    Layout 2, both numbers are changed by any adjuster button (a +/-)

    Expected Result

    The numbers and +/- should operate independently.

    Affected Browsers

    Should not be a browser specific issue, relates to compilation of events.

    Operating System and Service Pack

    Windows 8.1 current

    Construct 2 Version ID

    205.2

  • Sorry, not a bug.

    By definition of each association it can't work.

    Containers can have any two different objects paired together. Picked, created, and or destroyed, when something happens to one, it happens to the other.

    Families can only be by object type, due to the fact that not all objects can be referenced in the same way.

    That would be like having an array in a container with a sprite, and in a family, then saying when touched family, array set position to....

    This is a feature request, and it's been requested a lot.

  • Thanks newt

  • Sorry, not a bug.

    By definition of each association it can't work.

    Containers can have any two different objects paired together. Picked, created, and or destroyed, when something happens to one, it happens to the other.

    Families can only be by object type, due to the fact that not all objects can be referenced in the same way.

    That would be like having an array in a container with a sprite, and in a family, then saying when touched family, array set position to....

    This is a feature request, and it's been requested a lot.

    So, if what I am reading is correct, what you are saying is once an object is associated within a container it can no longer be associated by a family?

    That would explain why my custom depth system isnt working. Only specific sprite object manipulations work at that point?

    Dang.

    EDIT: odd, it doesnt seem to lose its family association even though its been placed inside of the container, only in that I cannot use family object references inside of each container, only direct sprite ones.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can use them together, you just can't reference the family to pick the contained object.

    Think of families as only working if they are blood related, and the non family object paired in the container is a step child.

  • The original .capx is now a 404 so closing as I cannot investigate it. However note that picking families does not also pick container instances (which is what I think newt was saying) for architectural and performance reasons. You can work around this by adding a condition to pick an instance with the same IID.

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