Question about layer blend mask

Discussion and feedback on Construct 2

Post » Fri Aug 14, 2015 6:42 pm

Hello, I have the following :

One background on a layer and some sprites on another layer
Image

How can I hide the top and bottom areas (or show only o center area) of the layer with sprites ? Something like in the following image:
Image

Something as Megaman 7 - Cloudman's Stage (1:45)

I've found this tutorial, but in not really what I want: https://www.scirra.com/tutorials/1336/m ... imple-mask
B
49
S
15
G
6
Posts: 534
Reputation: 7,195

Post » Sat Aug 15, 2015 12:33 am

@TGeorgeMihai

well, I found a way to do it - don't know if it is the best way or not. The layer with the cards on it needs to have "Force Own Texture" set to yes. Then you need solid rectangles for the top and bottom areas you want to block out. Then on top of those rectangles you need another rectangle with the effect "Source Out".

see my example: http://www.rieperts.com/games/forum/mask_test.capx

The piggies have Drag and Drop behavior so you can move them around to see how the masking looks...

Note: if your game is spawning new cards on that layer, you will always have to move the rectangles with the source out effect to the top of the layer after creating each card - otherwise the cards will be in front of the mask.
B
98
S
34
G
20
Posts: 438
Reputation: 17,815

Post » Sat Aug 15, 2015 8:32 pm

@AllanR

Thank you. This is what I needed :)
But I also would like to know the following (might be useful in the future):

- Can it be made to look as the sprites are fading away instead of being "cut" ?
- Instead of masking the margin, can it be made to show only a small part of the layer ?
- What is the recommended/optimised method to use for mobile devices ?
B
49
S
15
G
6
Posts: 534
Reputation: 7,195

Post » Sun Aug 16, 2015 12:36 am

To make things look like they are fading away, you usually make the mask with a gradient instead of a solid rectangle.

I don't understand what you mean by only showing a small part of the layer... (There is almost always a way to do anything - usually comes down to how difficult it is and how it performs).

These types of effects are generally well supported on mobile these days. The only requirement is that they need WebGL
B
98
S
34
G
20
Posts: 438
Reputation: 17,815

Post » Sun Aug 16, 2015 11:18 pm

@AllanR

Ok, I will try with gradient sprite. Witch sprite is indicated to have the gradient, the one at top or the one at bottom ?

Something like this:
Image
Instead of using big sprites to mask/hide, only use a small sprite to show that area of layer.

I will make some tests on my phone when I have a playable version.
B
49
S
15
G
6
Posts: 534
Reputation: 7,195


Return to Construct 2 General

Who is online

Users browsing this forum: JesusJ, troublesum and 10 guests