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

Bugs will be moved here once resolved.

Post » Tue May 26, 2015 12:25 pm

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 :(
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
My tutorial through development blog is at http://myconstruct2dev.blogspot.co.uk/
B
12
S
3
Posts: 221
Reputation: 1,328

Post » Tue May 26, 2015 2:29 pm

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.
Image ImageImage
B
168
S
50
G
163
Posts: 8,226
Reputation: 105,071

Post » Tue May 26, 2015 5:26 pm

Thanks newt :) I'm a bit of a Newbie with C2 :)
My tutorial through development blog is at http://myconstruct2dev.blogspot.co.uk/
B
12
S
3
Posts: 221
Reputation: 1,328

Post » Fri May 29, 2015 8:34 pm

newt wrote: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.
B
4
Posts: 33
Reputation: 266

Post » Fri May 29, 2015 9:19 pm

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.
Image ImageImage
B
168
S
50
G
163
Posts: 8,226
Reputation: 105,071

Post » Fri Jun 05, 2015 1:31 pm

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.
Scirra Founder
B
387
S
230
G
87
Posts: 24,249
Reputation: 192,240


Return to Closed bugs

Who is online

Users browsing this forum: No registered users and 3 guests