FlxCollision

@link http://www.photonstorm.com

Static methods

@:value({ AdjustWorldBounds : false, PlaceOutside : true })staticcreateCameraWall(Camera:FlxCamera, PlaceOutside:Bool = true, Thickness:Int, AdjustWorldBounds:Bool = false):FlxGroup

Creates a "wall" around the given camera which can be used for FlxSprite collision

Parameters:

Camera

The FlxCamera to use for the wall bounds (can be FlxG.camera for the current one)

Placement

Whether to place the camera wall outside or inside

Thickness

The thickness of the wall in pixels

AdjustWorldBounds

Adjust the FlxG.worldBounds based on the wall (true) or leave alone (false)

Returns:

FlxGroup The 4 FlxTileblocks that are created are placed into this FlxGroup which should be added to your State

@:value({ AlphaTolerance : 1 })staticpixelPerfectCheck(Contact:FlxSprite, Target:FlxSprite, AlphaTolerance:Int = 1, ?Camera:FlxCamera):Bool

A Pixel Perfect Collision check between two FlxSprites. It will do a bounds check first, and if that passes it will run a pixel perfect match on the intersecting area. Works with rotated and animated sprites. May be slow, so use it sparingly.

Parameters:

Contact

The first FlxSprite to test against

Target

The second FlxSprite to test again, sprite order is irrelevant

AlphaTolerance

The tolerance value above which alpha pixels are included. Default to 1 (anything that is not fully invisible).

Camera

If the collision is taking place in a camera other than FlxG.camera (the default/current) then pass it here

Returns:

Whether the sprites collide

@:value({ AlphaTolerance : 1 })staticpixelPerfectPointCheck(PointX:Int, PointY:Int, Target:FlxSprite, AlphaTolerance:Int = 1):Bool

A Pixel Perfect Collision check between a given x/y coordinate and an FlxSprite

Parameters:

PointX

The x coordinate of the point given in local space (relative to the FlxSprite, not game world coordinates)

PointY

The y coordinate of the point given in local space (relative to the FlxSprite, not game world coordinates)

Target

The FlxSprite to check the point against

AlphaTolerance

The alpha tolerance level above which pixels are counted as colliding. Default to 1 (anything that is not fully invisible).

Returns:

Boolean True if the x/y point collides with the FlxSprite, false if not