For each object IN LAYER x

This forum is currently in read-only mode.
  • Is there anything like this? Something to work like with families but, with layers?

  • 'Object is on layer X' condition.

  • Yes, I know that condition. But you need to do this condition with all object in the screen/layout.

  • I think he means

    + For each Sprite

    + Sprite is on layer X

    is exactly equivalent to 'For each object on layer X', which is what you want.

  • what aritz is saying is that if he has several different objects on layer 1, you would need to do that condition for each type

    but it couldnt really work

    'for each' conditions pick the objects one at a time

    for each object would present the problem that there isnt actions for objects in general.

    if you have sprite1, and sprite2 on layer1

    you cant say Set object position to 1

    the only way to do it would be families, which would work with the current method the devs mentioned

    even a hypothetical object action couldnt really work, since you could say set object position to sprite1, and sprite1 might already be the current object picked

  • Thanks lucid, this is exactly what I mean . I want to use layers as a group or family of objects, like another selection filter.

  • This problem is more generally represented: how to pick any objects of object type (for example, any sprite). One solution is to assign a family to every object of object type. For example, if you want to pick amongst every sprite, picking amongst family red equals to that, if every sprite belongs to family red.

    It's another family trick, I guess that families extend to many things they weren't originally even thought of... It's a bit hacky but it should work.

  • What's wrong with using a family and the for-each with a condition to test the layer?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well, nothing at all, but you'd have to add a family to every object for that to work. I think it would be generally more "elegant" if there was a way to address "any object (of type X)".

  • I don't think so - I think it'd be less elegant! You'd basically have extra icons in the event sheet editor for each type of plugin representing "all" those objects. They would basically useless, because they are too general - eg. actions in the "Sprite" class runs on ALL sprites, which is too broad - it'd include your UI sprites, effects sprites, terrain sprites, as well as players, bullets, enemies etc. etc. And then its functionality is identical to having added all those objects to a family anyway, but with the limitation you can't make it not apply to certain types of sprite. So it is actually less flexible, not to mention large changes to the runtime and event sheet editor to support this, which is hard work and would create new bugs. So I insist - just use a family!

  • well explained, and I agree, it would be useless to have such general expressions. That's pretty much what families were made for; to address specific groups of objects.

  • Ashley: Hm, now that you say it that way, I have to agree, it is more elegant that way, after all :D

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