An hxd.Pixels
-based collider. Checks for pixel color value under point to be above the cutoff value.
Note that it checks as channel > cutoff
, not channel >= cutoff
, hence cutoff value of 255 would never pass the test.
Constructor
new(pixels:Pixels, alphaCutoff:Int = 127, redCutoff:Int = 255, greenCutoff:Int = 255, blueCutoff:Int = 255, collideOnAny:Bool = true)
Create new BitmapCollider with specified bitmap, channel cutoff values and check mode.
Parameters:
pixels | The source pixel data which is tested against. |
---|---|
alphaCutoff | The alpha channel cutoff value. |
redCutoff | The red channel cutoff value. |
greenCutoff | The green channel cutoff value. |
blueCutoff | The blue channel cutoff value. |
collideOnAny | Whether to pass the collision check if any channel is above the threshold or if all channels should pass the test. |
Variables
alphaCutoff:Int
The alpha channel cutoff value in range of -1...255
Set to 255 to always fail the test.
blueCutoff:Int
The blue channel cutoff value in range of -1...255
Set to 255 to always fail the test.
collideOnAny:Bool
If true, will collide if any channel is above cutoff. Otherwise will collide only if all channels above their cutoff values.
greenCutoff:Int
The green channel cutoff value in range of -1...255
Set to 255 to always fail the test.