How do I mask a layer?

Get help using Construct 2

Post » Thu Apr 24, 2014 12:36 pm

Hello everyone,

I've been trying to figure out this problem for a while now and I can't find any solution to it.

I'm making an endless runner that's based on silhouettes. For the background, I've made some terrain sprites that are basically gradients, so the amount of black won't be too overbearing. What I'd like to do (and starting to think isn't possible at all) is for the sun to not be visible through the terrain, like it is now:

Image

I've tried to do this the way I've seen some people do alpha masks for lighting, but it didn't work at all...Any ideas?

EDIT: Attached example .capx:
OverlapExample.capx
You do not have the required permissions to view the files attached to this post.
B
5
G
1
Posts: 22
Reputation: 467

Post » Thu Apr 24, 2014 5:14 pm

One obvious workaround would be to make your background sprites fully opaque (you'll have to "bake" the gradient in to them) and put the sun and the moon sprites on a Layer behind the BG layer/Objects. Of Course, the way you have it now provides the opportunity to blend the the BG sprites with the BG sky color, like an atmospheric haze and you will lose that ability...

I am also interested in ways to do masking, I am forced to believe that there isn't an easy or effective way to do it in HTML5. And yes, I've seen the blend modes template, for the love of god, I can't replicate anything useful from that.

Masking should work like clipping layers in Photoshop or, even better, as within After Effects and have the ability to exist from object level (use a sprite to mask on other sprite(s)), to layer level (use a layer to mask other layer(s)).
composer - multimedia artist
www.eli0s.com/en/
B
69
S
27
G
6
Posts: 1,146
Reputation: 10,379

Post » Thu Apr 24, 2014 10:50 pm

At first I dismissed your comment since I had tried making them fully opaque before, and the player character was indistinguishable, since everything was black.

But your comment did give me the idea of adding the atmospheric haze as separate sprites that change opacity depending on what time of day it is (just like the background does). And, since I messed with the opacity formulas a little bit, it actually made the sunrise and the sunset look a lot better, so thank you very much for the suggestion!

So, yeah, masking seems to be a bit tricky at the moment, so I'm just going to rely on good old opacity. I do hope some more in-depth functionality gets added soon.

Cheers!
B
5
G
1
Posts: 22
Reputation: 467


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests