Hello! Do I have to explicitly use graphics object in new Phaser.Display.Masks.GeometryMask? My case:
new Phaser.Display.Masks.GeometryMask(scene, gameObject)
– works Ok in GL, no mask effect in Canvas
var mask = s.make.graphics();
mask.fillRect(gObj.x-20, gObj.y-20, 40, 40);
maskedObject.mask = new Phaser.Display.Masks.GeometryMask(s, mask);
– works Ok in GL and also in Canvas, but I need to “make” graphics object instead of use of original Sprite object
Thanks. It wasn’t clear from the documentation for me. I expected that the provided sprite object will automatically be understood as a clipping rectangle. And it also was, but only in GL context. So it leaves me bit confused. Ok. I will always use explicit s.make.graphics() shapes for defining masks.
Maybe one more ask for help:
var r3 = s.add.circle(gObj.x, gObj.y, 5);
r3.setStrokeStyle(6, 0x35d408, .5);
var rr = s.make.graphics();
rr.fillRect(gObj.x-20, gObj.y-20, 40, 40);
As you can see, it’s just a green circle over the sprite which radius raises over the tile rectangle. If I destroy the r3 circle only, the mask object itself will stay in memory? Will just r3.clearMask(); statement destroy mask itself? …thanks