Is it possible to mask a sprite with another sprite?

0 favourites
  • 6 posts
From the Asset Store
Basic template for drawing game with masks and easy customization
  • I'm trying to create a shade on objects of different shapes. Say you got blob 1, blob 2 etc. and I can pin a circular shade on it, but I won't the excess to be cut off and not shown. I pin it because I want the blob to rotate, but the 'angle' of the shade must remain the same, so it's set to pin to position only.

    I tried a few masking .capx but they all involve masking whole layers.

    So more like a clipping mask. Or is this not possible?

    Thanks.

    Tagged:

  • OK, perhaps I should clarify.. this is what I'm wanting to achieve in Construct 2:

    Thanks!

  • You can do this with blend modes. Both sprites need to be on the same layer with "Force own texture" enabled.

    The "Ball" sprite should have a gradient from black or grey to transparent (not to white). Put the ball above the red sprite and set "Source atop" blend mode for it. See this demo:

    dropbox.com/s/w77ytyb6wxfnuj0/BlendMode_BallMask.capx

  • Hey, thanks!

    That works great. I did notice however that when the sprites are overlapping eachother, the shadow is visible on the other sprite. And thus not cut off in that case.

    Is there a solution for this?

    Also, this might not be entirely related, but I also wanted to prevent overlapping when the sprites are created. Basically the sprites are randomly created from four sides (left right top bottom), sometimes they spawn in almost the same place, there are three sprites spawned each time from a side.

    I'm thinking using some sort of 'solid' or physics technique, but I think this will have unwanted effects. They're just simple bullets that always move exactly towards the center of the screen (as they're supposed to).

    Thanks again.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Do you mean when several red sprites are overlapping each other? I'm afraid you will need to keep each pair of sprites (red+shadow) on a separate layer.

    .

    There may be an effect you can use instead, a gradient mask or something like that, see this post:

    construct.net/en/forum/extending-construct-2/effects-31/webgl-effects-list-51897

    .

    Spawning without overlapping is one of the most popular questions here. Try searching the forum and you should find lots of examples. Here is one:

    construct.net/en/forum/construct-2/how-do-i-18/ideas-for-randomly-spread-out-142100

  • Yes, I meant when the red sprites were overlapping.

    OK, so I just used many layers and some global variables to call them on seperate layers. That works. Setting each layer to force own texture.

    I couldn't find that specific masking effect on that topic though.

    Thanks for your help!

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