Page 1 of 1

how to erase part of brush?

Posted: Thu Sep 14, 2023 2:54 pm
by Bugala
Never done this before and after trying for a while, decided to look help from here.

Thing is, I have a background Brush, and on top of that is displayed a brush that is showing all the buildings in the level.

Now what I want to do is that when one building is destroyed, this building would disappear from this brush that shows all the buildings.

What I am in practice trying to do, is draw a box that would make those pixels invisible, or erase them, but I dont seem to be able to achieve this.

Can someone give me a simple example like that?

Re: how to erase part of brush?

Posted: Thu Sep 14, 2023 6:30 pm
by jPV
If you're using alpha channels in brushes, this might be the easiest way. Or SelectBrush() would be another option...

Code: Select all

@DISPLAY 1, {Color=#BLUE}
CreateBrush(1, 800, 600, #RED, {AlphaChannel = True})
DisplayBrush(1, 0, 0)
WaitLeftMouse
Cls
SetFillStyle(#FILLCOLOR)

; Make a "hole" on the alpha channel
SetAlphaIntensity(0)
SelectAlphaChannel(1)
Box(100, 100, 50, 50)
EndSelect
DisplayBrush(1, 0, 0)
WaitLeftMouse

Re: how to erase part of brush?

Posted: Thu Sep 14, 2023 8:37 pm
by Bugala
Thanks. So simple but couldnt figure it out as I havent really dealt with that. I figured it is somehow drawing with color 0, but didnt know how. I tried using color $0000000 but that didnt work. Was also looking at MASK options, since that is just on and off, but couldnt figure out how to draw that 0 anywhere.