Jump to content

Create a hole with mask?


osinski
 Share

Recommended Posts

Hi!

I draw 2 rectangles

        var bigRect = this.game.add.graphics(0, 0);        bigRect.lineStyle(0);        bigRect.beginFill(0x3a1603,.43);        bigRect.drawRect(900, 120, 880, 880);        var smallRect = this.game.add.graphics(0, 0);        smallRect.lineStyle(0);        smallRect.beginFill(0xFFFFFF,1);        smallRect.drawRect(1100, 250, 100, 100);        

Can I get a hole in bigRect http://joxi.ru/8AnGvx9sNQk8rO using mask? Is it possible without mask?

Link to comment
Share on other sites

Hi!

I draw 2 rectangles

        var bigRect = this.game.add.graphics(0, 0);        bigRect.lineStyle(0);        bigRect.beginFill(0x3a1603,.43);        bigRect.drawRect(900, 120, 880, 880);        var smallRect = this.game.add.graphics(0, 0);        smallRect.lineStyle(0);        smallRect.beginFill(0xFFFFFF,1);        smallRect.drawRect(1100, 250, 100, 100);        

Can I get a hole in bigRect http://joxi.ru/8AnGvx9sNQk8rO using mask? Is it possible without mask?

I loaded 2 png rectangles instead of Graphics rectangles  and made something like that

var bmd = this.game.make.bitmapData(880, 881);bmd.draw('bigRect').blendDestinationOut().draw('mask', 110, 250).blendReset();this.game.add.image(897, 122, bmd);

Anyone know better way?

Link to comment
Share on other sites

  • 1 year later...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...