Can i hide objects behind an invisible layer?

0 favourites
  • 6 posts
From the Asset Store
Be discreet and rescue your friends from behind enemy lines.
  • Hi all,

    Maybe you can help me with this.

    I have yellow balls moving down and when they reach the bottom they re-appear at the top. What i'm trying to accomplish is a way to hide the yellow balls when they go outside of the game area(purple area), so that they only appear when they are inside the gaming area.

    I've tried reading tutorials online by adding different layers and using blend modes but can't seem to get it right. What happens is that either only the gaming area shows or only the sky etc, but i want both gaming area and sky to show just not the balls when they are outside in the sky area.

    I manage to do it without layers by by snipping the area i want to show over the balls, cropping it and putting it back as a sprite and placing it exactly over the area i cut out if this makes sense, and adding that layer on top over the balls. I don't like this way because the precision is not always correct and you can see unwanted lines in the sprites.

    I have attached an image showing how my scene looks like. Purple is gaming area, blue is the sky and yellow are the balls.

    Regards

    Edgar

  • The easiest solution is to put the blue sky sprite on a layer above the balls, so that it will be covering them.

    You can also do this with blend modes, for example Destination In. Place the balls and a rectangular mask sprite on a separate layer, set blend mode on the mask, set "Force own texture=yes" in layer properties. See Blend Modes template in C3.

  • Thanks for the reply,

    It's not so easy in my case just to add the background layer over the balls because i have 3 layers with with moving stars and a plain black background. I also tried adding a layer for Mask and using destination in but i can't make it work, i tried placing the balls and mask on the same layer and seperate layer.

    Maybe the photo below will give you a better idea of what i want to achieve. Please note that the lights are not on the same layer as the purple box, they are over it.

    Regards

    Edgar

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you very much. It works now.

    Do you also know how to show the game in full screen mode hiding the windows interface completely like you have on Scirra Arcade?

    Regards

    Edgar

  • Try Browser -> Request fullscreen. In web games it only works after any user input, like mouse click or key press.

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