[Solved] ...use masks in complex situations?

0 favourites
  • 11 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • hey everyone,

    I'm not sure how to best phrase it but i know often people call them masks in Flash and other places. I have an animation that's one long graphic that i want to scroll across th screen, BUT the catch is that i only want it seen inside a certain area and that area is on top of the rest of the scene.

    Can C2 use / make / however it works, have a mask effect? If so where would I start?

    Thanks!

    Caleb

  • Take a look at the blendmode example shipped with C2.

  • ooo interesting.. so blend mode is what i should be looking for

    Thanks!

    Caleb

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • hmmm ok so it seems like destination in would be ideal.. i have a mask graphic that is the right shape and i would only want the item i mark as destination in (like the example)

    it seems like there would need to be some way to link the two objects. the examples in C2 are nice, but deal with a single graphic on a solid color background.. my mask is a solid color graphic (my window to the animation if you will) on top of a colorful environment.

    I'm just not sure.. how to approach this. every combination of the blend modes either of the masked item or the masking item results in unacceptable results. maybe if i put them on another layer it would help? but i don't see how.

    i have to set the masking graphic to destination over so it's invisible to all other graphics, otherwise what good is a mask if you can see the mask right?

    the closest thing on the masked item that works in combination with thing item needed maked is set to Destination out, which you can see a clear difference between what's inside and what's outside the area to be exposed.. however the issue is that i can still see the masked object, albeit in another weird color.

    Maybe I need to use one of the more advanced effects? Overlay and Exclusion were interesting because they did crop the image but only to the side of the stage which isn't enough.

    To me the ideal solution would be to have a graphic that is 100% transparent to the viewer, but then have my other graphic be 100% hidden except when in empty (really transparent space) and not cause color distutions when the masked object passes over other colored background objects.

    dropbox.com/s/tpwsekb5kv5prpu/Screen%20Shot%202014-01-16%20at%2011.48.34%20AM.png

    this is one shot of what i'm seeing. This is just about perfect except that its' solid green blocking all of the other stuff. When i get it to be basically transparent, but not really masking the masked object it looks like this plus color distortion

    dropbox.com/s/4fh8mzvzw5qt3xt/Screen%20Shot%202014-01-16%20at%2011.46.03%20AM.png

    again close.. almost perfect if i didn't get the color distortion and the fact that you can see the effect through the mask.

    Thanks!

    Calebhttps://www.dropbox.com/s/tpwsekb5kv5prpu/Screen%20Shot%202014-01-16%20at%2011.48.34%20AM.png https://www.dropbox.com/s/4fh8mzvzw5qt3xt/Screen%20Shot%202014-01-16%20at%2011.46.03%20AM.png

  • I can't get to my C2 right now, but it should be something like this:

    Put mask and object on seperate layer, put the mask above the object you want to show partly, set the mask to destination in, set the layer to force own texture.

  • nevermind.. i found that.. still working through it to see if i can get closer to a good result.. so far it's the same. but i could be doing something wrong

  • ok so i'm trying some different things.. i did get it to look like this.. so far..   

    dropbox.com/s/hthlo60058m96ex/Screen%20Shot%202014-01-16%20at%2012.28.26%20PM.png

    but quick side quetsion.. why does my Z order screen often show a given object all by itself on a layer.. while there are other things on the same layer but yet it's showing that it's by itself? wouldn't all thing on layer 1 for example show they are on Layer1?   

    dropbox.com/s/m13rj93ygurd2oo/Screen%20Shot%202014-01-16%20at%2012.29.08%20PM.png

    ok nm.. i guess it does that when you click on a specific object.. just weird.. but i see them together if i click into empty space. :)

  • In the blendmode example the cog has a transparent area around it, it's the transparent area that blocks out the second spite where it doesn't seem to overlap. so if your mask sprite is the same height as the object sprite and the object sprite gas transparancy the mask sprite will be invisible. Put them on a seperate layer with force own texture and it will work.

  • Blendmode example

    Move the yellow flubber around to see how the effect is created.

    Layer has force own texture. yellow has source in blendmode and is above the mask sprite.

  • man that's trippy :)   but yea ok i'll play with this and see what i come up with.. very cool :)

  • ok yes I totally got it now... i had to back up and just start fresh taking your clear cut example into account.. i was worried the shape of my mask graphic would be a problem since it's not a straight square, but it worked out great. Thanks! :)

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