Hide/show a sprite with a mask

Get help using Construct 2

Post » Tue Oct 23, 2012 4:20 pm

Hi all!

I'd like to hide/reveal a sprite with an invisible "mask", in order to make a lifebar.



How would you proceed? Are there some tutorials?

Thanks!

Rag'
B
17
S
4
G
4
Posts: 137
Reputation: 3,767

Post » Tue Oct 23, 2012 7:38 pm

If there's any patterning or imagery on the health bar you can use a 'Tiled Background' object.. and then just reduce the width. The image will be cropped.

If it's just a plain coloured bar, you can use a normal sprite and reduce the width in the same way. Just remember to set 'sampling' to 'point' in the project settings. (this gets rid of any blurry edges)keepee2012-10-23 19:40:02
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

Post » Thu Oct 25, 2012 9:57 am

Thanks for your answer!

I used the first method and that will do the trick (by rotating the tiled BG since my bar has a specific shape).






But still, I'd really like to know how to hide/reveal a sprite with a mask, that's an information I'd really like to acquire... Could someone explain or show me an existing tutorial/example?
B
17
S
4
G
4
Posts: 137
Reputation: 3,767

Post » Thu Oct 25, 2012 12:58 pm

Using another object with the blend mode set to "destination out" might be of use.

It'll make it transparent, but also make the object underneath transparent where it overlaps.

Check out the "compositing" sectionkeepee2012-10-25 12:59:43
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

Post » Thu Oct 25, 2012 2:17 pm

I'll keep in mind your answer and this link, I'll be useful.

Thanks!
B
17
S
4
G
4
Posts: 137
Reputation: 3,767


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 17 guests