Hide/show a sprite with a mask

0 favourites
  • 5 posts
From the Asset Store
Minimal Sprite Font with Stroke for Pixel Art games.
  • Hi all!

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

    <img src="https://dl.dropbox.com/u/39121175/spritemasked.png" border="0" />

    How would you proceed? Are there some tutorials?



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

  • Try Construct 3

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

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

    <img src="https://dl.dropbox.com/u/39121175/spritemasked02.png" border="0" />

    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?

  • 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" section

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


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