Masking a sprite...

  • I've seen a few things about it but nothing really covers it exactly.

    What I would like to do is fairly simple I think. I just want a sprite that is invisible to the player...completely invisible. But when you mouse over the sprite, for example with an alpha mask attached to the mouse it's revealed.

    Tried this a few times by messing with the C2 lighting example but unless I'm trying to make a sniper scope I'm not seeing how to do this properly...if at all.

    Any ideas?

  • <img src="smileys/smiley24.gif" border="0" align="middle" />

    Set your Sprite Opacity to 0

    Event > Cursor is over "sprite"

    Action > Sprite Opacity = "100"

    ??

  • Thanks but that's not quite what I mean, it needs to be alpha masked. That would just reveal the entire sprite.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Uhm, wut? Alpha Masked? Tell me when this problem is solved, this is interesting.

  • Seek and ye shall find... an answer.

  • I've seen that, but I just don't get how to apply it to what I want =

    Thanks though.

    This is about as close as I can get: Example

    As you can see it's pretty much the opposite of what I want! <img src="smileys/smiley26.gif" border="0" align="middle">

    Except I want the red square to be completely invisible, the mask invisible as well. But when the mask goes over the red square you can see it through the mask.

    Feel like I'm close but I'm not sure what else to try.

  • put the red square on your bottom layer

    set your top layer transparency to "No"

    And that should work ^^

  • That works thanks but it gives the same result as the lighting demo in C2.

    In my project the top layer HAS to be transparent or it's not much use. Otherwise I would just be covering up backgrounds and other objects in my game. My posted .capx was just a basic example of the effect I'm after.

    Basically what I need is an invisible mask, to reveal an invisible sprite, with full on layer transparency. Oi, I'm getting a headache dealing with all these blend modes.

    Thanks for the help so far though everyone :)

  • maybe having another layer on top of all of these, which is transparent (I don't see myself another solution, but it should exists)

    EDIT: maybe the example inside C2 can help you, it is called Blend modes I think (it is a example template which can be loaded in a new project, just to see)

  • Thanks that was helpful.

    So I learned that if I turn off the blending mode for the red square and set the mask to destination in, it...sort of works. But same problem as before, the red square is still always visible.

    If I could just get the red square to be invisible now I would have it.

    Updated capx

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