mokargas Posted October 5, 2016 Share Posted October 5, 2016 Hey there all, I'm confused with masking I have two layers (Phaser.Groups). The bottom layer contains some objects, the top layer contains a simple animated Phaser TileSprite. (Image attached, I've used a nautical analogy ) What I'm trying to do is punch a hole in the top layer, so you can see objects on the bottom layer. I have assumed a mask is the best way to do this. The mask also moves with the mouse pointer. I am drawing the mask via graphics (basically just a white drawCircle of a fixed size), and applying it via the mask property on the top-most Tilesprite. Unfortunately, when apply the mask to that top layer, it shows a circular portion of the top layer and I can see the entire bottom layer. Basically I need the inverse of that - is an inverted mask possible? samme 1 Link to comment Share on other sites More sharing options...
mokargas Posted October 6, 2016 Author Share Posted October 6, 2016 Just found this, which is exactly what I want to do https://software.intel.com/en-us/html5/hub/blogs/cutting-through-images-in-canvas The game mentioned was actually made by PhotonStorm. Unfortunately I can't demo the game because I'm not in the UK. Anyone know of a mirror? Link to comment Share on other sites More sharing options...
mokargas Posted October 6, 2016 Author Share Posted October 6, 2016 I was going about this the wrong way (the "intuitive way"). The water layer actually needs to be on the bottom. The items layer needs to be on top, and is then masked using a Graphics object The seabed layer is also masked using the same Graphics object, placed behind the items and job done samme 1 Link to comment Share on other sites More sharing options...
Recommended Posts