Hi, so I was happy to see mask support on a container. However I think it’s implemented only the half way. The following is the game I made:
In the avatar selection dialog, the list of avatars are on a scrollable container with clipping mask on. I’m pretty sure unless making a flappy bird, most game devs will need something similar. To implement this, I had to:
- create a geometry mask
- on every update call when dialog is being opened, closed, or resized, I get world matrix of the container and apply it to the mask
- on pointerdown, if coordinates are outside of the mask, i ignore the event and bubble it up
I’m only 3 weeks old in phaser, and am not familiar with your architecture, so possibly, I am not doing it right. However I think the mask object that I create should act like any other sprite object that can be attached to a container.
i.e.) I create a mask object (let it be sprite or some shape with physical width and height). being a game object, it will have transform (x, y, width, and height), however this mask object doesn’t render, but modifies stencil buffer instead. When attached to a container, it’ll respect its relative position and scaling of its parent. any children of this container will have to go through a shader that looks at the stencil buffer.
Secondly input will also use mask and ignore elements that are clipped away.
Thoughts? Other than that, I am pretty satisfied with your engine so far. Thanks!
gabe