How do I make an object invisible were it doesn't overlap

Get help using Construct 2

Post » Wed Mar 19, 2014 4:46 pm

I'm creating a puzzle
where a few long sprites (let's call them l1, l2, l3, and l4) are scrolled vertically
through a few small transparent windows
in an otherwise opaque image. (a single sprite called b1)

The problem is the long sprites are overlapping, so they show up in more than one window.
I can't solve the problem using Z-order, since there is always at least one sprite that is being covered by the others
no matter what the Z-order.

I've already created transparent sprites that mark the location of the windows. (lets call them t1, t2, t3 and t4)

I want only the part of the long sprite that is in the window to be visible,
hence I want only that part of the long sprite that is overlapping with the transparent window sprite
to be visible for each pair of sprites.

So I want l1 to be visible only were it is overlapping t1, not were it's overlapping t2, t3 or t4.
Same thing with l2 and t2, l3 and t3, etc.
(And no, I can not prevent l1 from overlapping t2, t3, or t4.)

How can I do this?

So far I've tried all combinations of blend modes, Z-orders, effects and whatnot I can think of and nothing is working.

I suppose I could break up l1, l2, etc. into several smaller sprites, pin them together, and hide each one once they are no longer overlapping t1, t2 etc. but it's a lot of work since they are very long sprites and there's a lot of overlap to avoid.

If only there was a blend mode like destination in but were the alfa in the image ontop actually made the underlying image go transparent instead of black....
B
3
Posts: 6
Reputation: 185

Post » Wed Mar 19, 2014 4:50 pm

without seeing your capx or a video I don't know for sure ( not that I'm any better at figuring things out than you).
However, could you put the long sprites on a different layer and just hide part of the layer?
B
7
S
2
Posts: 158
Reputation: 1,021

Post » Wed Mar 19, 2014 4:52 pm

OR what if you created 2 separate sprites? 1 long sprite and 1 short sprite. Just destroy ( or set invisible) the long sprite and pin the short sprite to the same location?
B
7
S
2
Posts: 158
Reputation: 1,021

Post » Wed Mar 19, 2014 4:58 pm

Z-order doesn't solve the problem. (and that's all that layers are essentially)

I need the long sprites so I can scroll them vertically through the windows,
I'm not sure what the short sprites are you are referring to.
Please refer to the sprites in question by name. (l1, t1, etc.)
B
3
Posts: 6
Reputation: 185

Post » Wed Mar 19, 2014 5:26 pm

I don't really understand what's going on, but it looks like your are looking for masks, I'm also not sure if they exist in C2.
You should try to search for masks in C2, maybe there's a plugin or something you could use.
Please tag me with @caiorosisca if your post is refering to me :). I don't always follow the topics I answer.
B
11
S
4
G
1
Posts: 272
Reputation: 1,643

Post » Fri Mar 21, 2014 4:01 am

Masking is simple in C2. Use Destination Out and set that layer to Force Own Texture. Unless I missed what you were looking for...
B
103
S
38
G
19
Posts: 962
Reputation: 17,986

Post » Mon Mar 24, 2014 4:20 pm

Setting the layer to Force Own Texture doesn't solve anything I'm afraid.

For instance l2 shows up in the transparent windows in b1 covered by t1, t2 and t3.
I could make l2 show up only in t2, by putting t1 and t3 above t2 (below b1) in the Z-order
and use the copy blend mode (for instance)
but then I'd have to put l1 above t1, which would put it above t2 as well,
and then we have overlap again.

If I could only use paradoxical Z-ordering (c above a above b above c) it wouldn't be a problem...
Or if there was any other way to make t1 mask l2 but not l1, while at the same time making t2 mask l1 but not l2.
But as far as I know there is no way to make a sprite mask one other sprite only.
B
3
Posts: 6
Reputation: 185


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 3 guests