class flixel.util.FlxRect implements IFlxPooled

Available on all platforms

Stores a rectangle.

Class Fields

static function get(?X:Float = 0, ?Y:Float = 0, ?Width:Float = 0, ?Height:Float = 0):FlxRect

Recycle or create new FlxRect. * Be sure to put() them back into the pool after you're done with them! * *

X

The X-coordinate of the point in space. *

Y

The Y-coordinate of the point in space.

Instance Fields

var bottom:Float

The y coordinate of the bottom of the rectangle.

var left:Float

The x coordinate of the left side of the rectangle.

var right:Float

The x coordinate of the right side of the rectangle.

var top:Float

The x coordinate of the top of the rectangle.

var x:Float

var y:Float

function new(?X:Float = 0, ?Y:Float = 0, ?Width:Float = 0, ?Height:Float = 0):Void

function containsFlxPoint(Point:FlxPoint):Bool

Returns true if this FlxRect contains the FlxPoint * *

Point

The FlxPoint to check *

returns

True if the FlxPoint is within this FlxRect, otherwise false

function copyFrom(Rect:FlxRect):FlxRect

Helper function, just copies the values from the specified rectangle. * *

Rect

Any FlxRect. *

returns

A reference to itself.

function copyFromFlash(FlashRect:Rectangle):FlxRect

Helper function, just copies the values from the specified Flash rectangle. * *

FlashRect

Any Rectangle. *

returns

A reference to itself.

function copyTo(Rect:FlxRect):FlxRect

Helper function, just copies the values from this rectangle to the specified rectangle. * *

Point

Any FlxRect. *

returns

A reference to the altered rectangle parameter.

function copyToFlash(FlashRect:Rectangle):Rectangle

Helper function, just copies the values from this rectangle to the specified Flash rectangle. * *

Point

Any Rectangle. *

returns

A reference to the altered rectangle parameter.

function destroy():Void

Necessary for IFlxDestroyable.

function overlaps(Rect:FlxRect):Bool

Checks to see if some FlxRect object overlaps this FlxRect object. * *

Rect

The rectangle being tested. *

returns

Whether or not the two rectangles overlap.

function put():Void

Add this FlxRect to the recycling pool.

function set(?X:Float = 0, ?Y:Float = 0, ?Width:Float = 0, ?Height:Float = 0):FlxRect

Fill this rectangle with the data provided. * *

X

The X-coordinate of the point in space. *

Y

The Y-coordinate of the point in space. *

Width

Desired width of the rectangle. *

Height

Desired height of the rectangle. *

returns

A reference to itself.

function setSize(Width:Float, Height:Float):FlxRect

Shortcut for setting both width and Height. * *

Width

The new sprite width. *

Height

The new sprite height.

function toString():String

Convert object to readable string name. Useful for debugging, save games, etc.

function union(Rect:FlxRect):FlxRect

Add another rectangle to this one by filling in the * horizontal and vertical space between the two rectangles. * *

Rect

The second FlxRect to add to this one *

returns

The changed FlxRect