solinari6 Posted September 17, 2016 Share Posted September 17, 2016 Can you create complex shapes in phaser? I want to draw a rectangle, and then subtract a circle from the center of the rectangle (so you can get a small circular window into what is behind the rectangle). But I'm not seeing any way that is possible ... I see a few things about seeing if shapes interact, but don't see anything about subtracting one shape from another. Link to comment Share on other sites More sharing options...
squilibob Posted September 18, 2016 Share Posted September 18, 2016 You can use a mask to do that function addmask(obj) { mask = game.add.graphics(0, 0); mask.beginFill(0xffffff); mask.drawCircle(obj.centerX, obj.centerY, obj.getBounds().width/2); mask.endFill(); return mask; } graphics.mask = addmask(graphics); samme 1 Link to comment Share on other sites More sharing options...
solinari6 Posted September 19, 2016 Author Share Posted September 19, 2016 Thanks ... I just gave that a shot, and it appears it did the OPPOSITE of what I wanted Looks like that mask lays the circle on top of the rectangle, and only shows those parts that both have in common (which means it just shows a circle). What I'm looking for is to overlay the circle on top of the rectangle, and DELETE the parts that both have in common from the sprite. I guess it's a inverted mask? Link to comment Share on other sites More sharing options...
Recommended Posts