class flixel.util.FlxCollision

Available on all platforms

FlxCollision * * @link http://www.photonstorm.com * @author Richard Davey / Photon Storm

Class Fields

static function createCameraWall(Camera:FlxCamera, Placement:Int, Thickness:Int, ?AdjustWorldBounds:Bool = false):FlxGroup

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

Camera

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

Placement

CAMERAWALLOUTSIDE or CAMERAWALLINSIDE *

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

static function pixelPerfectCheck(Contact:FlxSprite, Target:FlxSprite, ?AlphaTolerance:Int = 1, ?Camera:FlxCamera = null):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. * *

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

static function pixelPerfectPointCheck(PointX:Int, PointY:Int, Target:FlxSprite, ?AlphaTolerance:Int = 1):Bool

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

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