How do I make a layer only visible in a region? [SOLVED]

0 favourites
  • 7 posts
  • I want to make certain objects in a layer only be seen within the "screen" of an object, the rest should be behind the background or simply not visible, been wondering for some time only finding really innefficient methods, I know there must be a simple way of approaching this... Any help?

  • Not sure about the best simple way of doing this, but here's how I would approach it:

    1. I would edit the animation of the "phone" object and add another image point and place that point in the upper-left corner of the "phones" "screen".

    2. Then I would take the other sprites, I make them initially invisible and set their origin points to 0, 0.

    3. Then I would make events if sprite position(x, y) is equal to the position(x,y) of the "phones" image point, then set sprite x visible.

    If it's not equal then set it back to invisible. And do that for both sprites, or if you have more sprites, create a family put them in it, and then do that event for the family.

  • You can probably just recreate the Example: Lighting file but with your screen.

    Basically, try setting the screen's blend mode to Destination Out, then make the layer the screen is on opaque and turn on Force Own Textures for it.

  • Hmm, I don´t think I could do VIKINGS ´ idea because I use smooth sliding and that would leave some parts of the screen empty with sprites popping etc... I´ll give both a try right now anyway! Thanks a lot

  • It should be as easy as choosing the right blendmode..

  • Y̶e̶a̶h̶,̶ ̶I̶ ̶d̶o̶n̶´̶t̶ ̶u̶s̶e̶ ̶t̶h̶e̶m̶ ̶o̶f̶t̶e̶n̶.̶.̶.̶ ̶I̶t̶ ̶w̶o̶r̶k̶s̶ ̶u̶s̶i̶n̶g̶ ̶d̶e̶s̶t̶i̶n̶a̶t̶i̶o̶n̶ ̶o̶u̶t̶ ̶b̶u̶t̶ ̶m̶y̶ ̶o̶n̶l̶y̶ ̶c̶o̶m̶p̶l̶a̶i̶n̶ ̶i̶s̶ ̶t̶h̶a̶t̶ ̶I̶ ̶c̶a̶n̶´̶t̶ ̶f̶i̶n̶d̶ ̶a̶ ̶w̶a̶y̶ ̶t̶o̶ ̶p̶u̶t̶ ̶b̶a̶c̶k̶g̶r̶o̶u̶n̶d̶ ̶o̶b̶j̶e̶c̶t̶s̶ ̶t̶h̶a̶t̶ ̶a̶r̶e̶ ̶b̶e̶h̶i̶n̶d̶ ̶t̶h̶e̶ ̶s̶c̶r̶e̶e̶n̶ ̶b̶u̶t̶ ̶o̶n̶ ̶t̶o̶p̶ ̶o̶f̶ ̶t̶h̶e̶ ̶s̶o̶l̶i̶d̶ ̶b̶a̶c̶k̶g̶r̶o̶u̶n̶d̶!̶

    L̶a̶y̶e̶r̶s̶:̶

    -̶s̶t̶u̶f̶f̶ ̶(̶s̶o̶l̶i̶d̶ ̶c̶o̶l̶o̶r̶,̶ ̶h̶a̶s̶ ̶t̶h̶e̶ ̶d̶e̶s̶t̶i̶n̶a̶t̶i̶o̶n̶ ̶o̶u̶t̶ ̶o̶b̶j̶e̶c̶t̶)̶

    -̶s̶c̶r̶e̶e̶n̶ ̶(̶h̶a̶s̶ ̶a̶l̶l̶ ̶t̶h̶e̶ ̶c̶o̶m̶p̶o̶n̶e̶n̶t̶s̶ ̶t̶h̶a̶t̶ ̶h̶i̶d̶e̶ ̶b̶e̶h̶i̶n̶d̶ ̶"̶s̶t̶u̶f̶f̶"̶´̶s̶ ̶s̶o̶l̶i̶d̶ ̶b̶a̶c̶k̶g̶r̶o̶u̶n̶d̶)̶

    -̶b̶a̶c̶k̶ ̶(̶c̶a̶n̶´̶t̶ ̶b̶e̶ ̶s̶e̶e̶n̶ ̶b̶e̶c̶a̶u̶s̶e̶ ̶o̶f̶ ̶"̶s̶t̶u̶f̶f̶"̶´̶s̶ ̶s̶o̶l̶i̶d̶ ̶b̶a̶c̶k̶g̶r̶o̶u̶n̶d̶)̶

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Never mind, figured this out. Thanks, everyone!

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