Question about layer blend mask

  • Hello, I have the following :

    One background on a layer and some sprites on another layer

    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:

    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

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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 ?
  • 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

  • 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:

    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.

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