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

@:value({ collideOnAny : true, blueCutoff : 255, greenCutoff : 255, redCutoff : 255, alphaCutoff : 127 })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.

pixels:Pixels

The source pixel data which is tested against.

redCutoff:Int

The red channel cutoff value in range of -1...255

Set to 255 to always fail the test.

@:value(1)scaleX:Float = 1

Horizontal stretch of pixels to check for collision.

@:value(1)scaleY:Float = 1

Vertical stretch of pixels to check for collision.

Methods

contains(p:Point):Bool

Checks if the pixel under given Point p passes the threshold test.

Inherited Variables

Inherited Methods