pistacchio Posted September 18, 2015 Share Posted September 18, 2015 Hi,how can i define a region of the screen and crop some game elements that are inside of it so? Look at the following example: In 1 you can see how i have some green elements, and some red sprites and yellow particles within the pink region. I'd like to leave the green sprites untouched, but specify that red and yellow sprites belong to the pink region and so, if some parts of them is outside the region, just don't show them. Link to comment Share on other sites More sharing options...
Tom Atom Posted September 18, 2015 Share Posted September 18, 2015 Hi, look at this article: http://www.goodboydigital.com/pixi-js-brings-canvas-and-webgl-masking/ Unfortunately this works only for simple mask shapes - if you want something complex like "fence" view then you probably cannot (in WebGL it would be possible if you employed stencil buffer somehow, but I have no idea, how to make it for both Canvas+WebGL) Link to comment Share on other sites More sharing options...
MichaelD Posted September 18, 2015 Share Posted September 18, 2015 You can create a group containing the pink+yellow+red apply a mask to it. And draw the greens as a separate entity (sprite,image, etc) Link to comment Share on other sites More sharing options...
Recommended Posts