Using alpha of one layer to mask another layer

  • Using alpha of one layer to mask another layer...

    Is this possible?

    I want to make a dust particle effect inside of a lightbeam, so that the dust is only visible within the light beam.

    (Light beam(s) on Top layer, dust covering complete bottom layer)

    But I also have Layers with content below and I don't want those to be affected. So i can't use the "destination out" blend mode.

    Any Ideas?

  • You can use destination out but you should use the force own texture for the layer.

    Made this one not too long ago for someone else

  • OK this one helped me...(Thanks a lot so far) so I have to do it on the same layer.

    Still have one problem:

    The masking of my Lightbeam now works, but only inside the boundaries of the image itself. This would mean to accoplish my desired effect I would need a huge Transparent area in my Image that covers the whole layout, which would waste a lot of memory.

    Any Ideas on that as well?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • you'd only have to mask the viewport, not the entire layout.

    If you use one or more instances (depending on how you've set things up) of a transparant tiledbackground of 2x2 for that it should work.

    I'm not even sure all has to be covered if you set things up properly, but if you have to?

  • yeah you're right, the tiled background would do the trick, I didn't think of the possibility to use more than one object for masking my dust.

    Thanks a lot

  • Thanks again for your Help, you can see the Result here if you want:

    www.againstgravity.de (choose Testlevel)

    Controls:

    When hitting LMB the ship will rotate towards the Mouse Cursor and give thrust relative to the distance ship/cursor.

    It's best to place the cursor over the ship, press and hold LMB and then move the mouse up slowly to get a feeling for the controls.

    While LMB is pressed you can throw bombs with RMB.

    While LMB is released you can shoot lasers towards the cursor.

    What do you think?

  • Wow! Looks gorgeous.

  • That is very good.

  • Looking gorgeous, glad I could help!

  • Really great-looking game! Definitely one of the higher quality C2 games I've seen!

  • Thanks to you all, means a lot to me.

  • I really do love the dust particles in the light effect.

    I've been trying to do something similar myself, but I just can't get this destination out setting to do what I want.

    How exactly does the transparent tiled layer need to be set up to get rid of the boxes appearing around my particle sprites?

  • The trick is that there are no actual particles.

    I have ONE Layer with "force own texture" EDIT: And set to "Additive"

    In This Layer are (from top to bottom)

    • the sprite containing the lightbeams with tiledBG objects around to mask the rest of the viewport
    • two huge rotating tiledBG objects containing the dust texture along with dust particles
    • additional green dust sprites for the collectable crystals

    That's basically it

  • H*ly shit that game looks nice. Hope to see more of that soon.

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