For each object IN LAYER x

For questions about using Classic.

Post » Sun Sep 13, 2009 4:12 pm

Is there anything like this? Something to work like with families but, with layers?
B
30
S
15
G
10
Posts: 285
Reputation: 7,144

Post » Sun Sep 13, 2009 7:24 pm

'Object is on layer X' condition.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Mon Sep 14, 2009 2:49 pm

Yes, I know that condition. But you need to do this condition with all object in the screen/layout.
B
30
S
15
G
10
Posts: 285
Reputation: 7,144

Post » Mon Sep 14, 2009 4:52 pm

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.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,518

Post » Mon Sep 14, 2009 5:12 pm

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
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Tue Sep 15, 2009 9:37 am

Thanks lucid, this is exactly what I mean :). I want to use layers as a group or family of objects, like another selection filter.
B
30
S
15
G
10
Posts: 285
Reputation: 7,144

Post » Tue Sep 15, 2009 9:41 am

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.
B
3
S
2
G
5
Posts: 263
Reputation: 2,201

Post » Tue Sep 15, 2009 5:03 pm

What's wrong with using a family and the for-each with a condition to test the layer?
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,518

Post » Thu Sep 17, 2009 12:02 pm

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)".
B
3
S
2
G
5
Posts: 263
Reputation: 2,201

Post » Thu Sep 17, 2009 6:20 pm

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!
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,518

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests