Package | org.flixel.system |
Class | public class FlxQuadTree |
Inheritance | FlxQuadTree FlxRect Object |
Property | Defined By | ||
---|---|---|---|
bottom : Number [read-only]
The Y coordinate of the bottom of the rectangle. | FlxRect | ||
divisions : uint [static]
Controls the granularity of the quad tree. | FlxQuadTree | ||
height : Number | FlxRect | ||
left : Number [read-only]
The X coordinate of the left side of the rectangle. | FlxRect | ||
right : Number [read-only]
The X coordinate of the right side of the rectangle. | FlxRect | ||
top : Number [read-only]
The Y coordinate of the top of the rectangle. | FlxRect | ||
width : Number | FlxRect | ||
x : Number | FlxRect | ||
y : Number | FlxRect |
Property | Defined By | ||
---|---|---|---|
_bottomEdge : Number
Internal, governs and assists with the formation of the tree. | FlxQuadTree | ||
_canSubdivide : Boolean
Whether this branch of the tree can be subdivided or not. | FlxQuadTree | ||
_checkObjectHullHeight : Number [static]
Internal, helpers for comparing actual object-to-object overlap - see overlapNode(). | FlxQuadTree | ||
_checkObjectHullWidth : Number [static]
Internal, helpers for comparing actual object-to-object overlap - see overlapNode(). | FlxQuadTree | ||
_checkObjectHullX : Number [static]
Internal, helpers for comparing actual object-to-object overlap - see overlapNode(). | FlxQuadTree | ||
_checkObjectHullY : Number [static]
Internal, helpers for comparing actual object-to-object overlap - see overlapNode(). | FlxQuadTree | ||
_halfHeight : Number
Internal, governs and assists with the formation of the tree. | FlxQuadTree | ||
_halfWidth : Number
Internal, governs and assists with the formation of the tree. | FlxQuadTree | ||
_headA : FlxList
Refers to the internal A and B linked lists,
which are used to store objects in the leaves. | FlxQuadTree | ||
_headB : FlxList
Refers to the internal A and B linked lists,
which are used to store objects in the leaves. | FlxQuadTree | ||
_iterator : FlxList [static]
Internal, used during tree processing and overlap checks. | FlxQuadTree | ||
_leftEdge : Number
Internal, governs and assists with the formation of the tree. | FlxQuadTree | ||
_list : uint [static]
Internal, used during tree processing and overlap checks. | FlxQuadTree | ||
_midpointX : Number
Internal, governs and assists with the formation of the tree. | FlxQuadTree | ||
_midpointY : Number
Internal, governs and assists with the formation of the tree. | FlxQuadTree | ||
_min : uint [static]
Internal, governs and assists with the formation of the tree. | FlxQuadTree | ||
_northEastTree : FlxQuadTree
Internal, governs and assists with the formation of the tree. | FlxQuadTree | ||
_northWestTree : FlxQuadTree
Internal, governs and assists with the formation of the tree. | FlxQuadTree | ||
_notifyCallback : Function [static]
Internal, used during tree processing and overlap checks. | FlxQuadTree | ||
_object : FlxObject [static]
Internal, used to reduce recursive method parameters during object placement and tree formation. | FlxQuadTree | ||
_objectBottomEdge : Number [static]
Internal, used to reduce recursive method parameters during object placement and tree formation. | FlxQuadTree | ||
_objectHullHeight : Number [static]
Internal, helpers for comparing actual object-to-object overlap - see overlapNode(). | FlxQuadTree | ||
_objectHullWidth : Number [static]
Internal, helpers for comparing actual object-to-object overlap - see overlapNode(). | FlxQuadTree | ||
_objectHullX : Number [static]
Internal, helpers for comparing actual object-to-object overlap - see overlapNode(). | FlxQuadTree | ||
_objectHullY : Number [static]
Internal, helpers for comparing actual object-to-object overlap - see overlapNode(). | FlxQuadTree | ||
_objectLeftEdge : Number [static]
Internal, used to reduce recursive method parameters during object placement and tree formation. | FlxQuadTree | ||
_objectRightEdge : Number [static]
Internal, used to reduce recursive method parameters during object placement and tree formation. | FlxQuadTree | ||
_objectTopEdge : Number [static]
Internal, used to reduce recursive method parameters during object placement and tree formation. | FlxQuadTree | ||
_processingCallback : Function [static]
Internal, used during tree processing and overlap checks. | FlxQuadTree | ||
_rightEdge : Number
Internal, governs and assists with the formation of the tree. | FlxQuadTree | ||
_southEastTree : FlxQuadTree
Internal, governs and assists with the formation of the tree. | FlxQuadTree | ||
_southWestTree : FlxQuadTree
Internal, governs and assists with the formation of the tree. | FlxQuadTree | ||
_tailA : FlxList
Refers to the internal A and B linked lists,
which are used to store objects in the leaves. | FlxQuadTree | ||
_tailB : FlxList
Refers to the internal A and B linked lists,
which are used to store objects in the leaves. | FlxQuadTree | ||
_topEdge : Number
Internal, governs and assists with the formation of the tree. | FlxQuadTree | ||
_useBothLists : Boolean [static]
Internal, used during tree processing and overlap checks. | FlxQuadTree |
Method | Defined By | ||
---|---|---|---|
FlxQuadTree(X:Number, Y:Number, Width:Number, Height:Number, Parent:FlxQuadTree = null)
Instantiate a new Quad Tree node. | FlxQuadTree | ||
Call this function to add an object to the root of the tree. | FlxQuadTree | ||
Helper function, just copies the values from the specified rectangle. | FlxRect | ||
copyFromFlash(FlashRect:Rectangle):FlxRect
Helper function, just copies the values from the specified Flash rectangle. | FlxRect | ||
Helper function, just copies the values from this rectangle to the specified rectangle. | FlxRect | ||
copyToFlash(FlashRect:Rectangle):Rectangle
Helper function, just copies the values from this rectangle to the specified Flash rectangle. | FlxRect | ||
destroy():void
Clean up memory. | FlxQuadTree | ||
execute():Boolean
FlxQuadTree's other main function. | FlxQuadTree | ||
load(ObjectOrGroup1:FlxBasic, ObjectOrGroup2:FlxBasic = null, NotifyCallback:Function = null, ProcessCallback:Function = null):void
Load objects and/or groups into the quad tree, and register notify and processing callbacks. | FlxQuadTree | ||
Instantiate a new rectangle. | FlxRect | ||
Checks to see if some FlxRect object overlaps this FlxRect object. | FlxRect |
Method | Defined By | ||
---|---|---|---|
addObject():void
Internal function for recursively navigating and creating the tree
while adding objects to the appropriate nodes. | FlxQuadTree | ||
addToList():void
Internal function for recursively adding objects to leaf lists. | FlxQuadTree | ||
overlapNode():Boolean
An internal function for comparing an object against the contents of a node. | FlxQuadTree |
Constant | Defined By | ||
---|---|---|---|
A_LIST : uint = 0 [static]
Flag for specifying that you want to add an object to the A list. | FlxQuadTree | ||
B_LIST : uint = 1 [static]
Flag for specifying that you want to add an object to the B list. | FlxQuadTree |
_bottomEdge | property |
protected var _bottomEdge:Number
Internal, governs and assists with the formation of the tree.
_canSubdivide | property |
protected var _canSubdivide:Boolean
Whether this branch of the tree can be subdivided or not.
_checkObjectHullHeight | property |
protected static var _checkObjectHullHeight:Number
Internal, helpers for comparing actual object-to-object overlap - see overlapNode()
.
_checkObjectHullWidth | property |
protected static var _checkObjectHullWidth:Number
Internal, helpers for comparing actual object-to-object overlap - see overlapNode()
.
_checkObjectHullX | property |
protected static var _checkObjectHullX:Number
Internal, helpers for comparing actual object-to-object overlap - see overlapNode()
.
_checkObjectHullY | property |
protected static var _checkObjectHullY:Number
Internal, helpers for comparing actual object-to-object overlap - see overlapNode()
.
_halfHeight | property |
protected var _halfHeight:Number
Internal, governs and assists with the formation of the tree.
_halfWidth | property |
protected var _halfWidth:Number
Internal, governs and assists with the formation of the tree.
_headA | property |
protected var _headA:FlxList
Refers to the internal A and B linked lists, which are used to store objects in the leaves.
_headB | property |
protected var _headB:FlxList
Refers to the internal A and B linked lists, which are used to store objects in the leaves.
_iterator | property |
protected static var _iterator:FlxList
Internal, used during tree processing and overlap checks.
_leftEdge | property |
protected var _leftEdge:Number
Internal, governs and assists with the formation of the tree.
_list | property |
protected static var _list:uint
Internal, used during tree processing and overlap checks.
_midpointX | property |
protected var _midpointX:Number
Internal, governs and assists with the formation of the tree.
_midpointY | property |
protected var _midpointY:Number
Internal, governs and assists with the formation of the tree.
_min | property |
protected static var _min:uint
Internal, governs and assists with the formation of the tree.
_northEastTree | property |
protected var _northEastTree:FlxQuadTree
Internal, governs and assists with the formation of the tree.
_northWestTree | property |
protected var _northWestTree:FlxQuadTree
Internal, governs and assists with the formation of the tree.
_notifyCallback | property |
protected static var _notifyCallback:Function
Internal, used during tree processing and overlap checks.
_object | property |
protected static var _object:FlxObject
Internal, used to reduce recursive method parameters during object placement and tree formation.
_objectBottomEdge | property |
protected static var _objectBottomEdge:Number
Internal, used to reduce recursive method parameters during object placement and tree formation.
_objectHullHeight | property |
protected static var _objectHullHeight:Number
Internal, helpers for comparing actual object-to-object overlap - see overlapNode()
.
_objectHullWidth | property |
protected static var _objectHullWidth:Number
Internal, helpers for comparing actual object-to-object overlap - see overlapNode()
.
_objectHullX | property |
protected static var _objectHullX:Number
Internal, helpers for comparing actual object-to-object overlap - see overlapNode()
.
_objectHullY | property |
protected static var _objectHullY:Number
Internal, helpers for comparing actual object-to-object overlap - see overlapNode()
.
_objectLeftEdge | property |
protected static var _objectLeftEdge:Number
Internal, used to reduce recursive method parameters during object placement and tree formation.
_objectRightEdge | property |
protected static var _objectRightEdge:Number
Internal, used to reduce recursive method parameters during object placement and tree formation.
_objectTopEdge | property |
protected static var _objectTopEdge:Number
Internal, used to reduce recursive method parameters during object placement and tree formation.
_processingCallback | property |
protected static var _processingCallback:Function
Internal, used during tree processing and overlap checks.
_rightEdge | property |
protected var _rightEdge:Number
Internal, governs and assists with the formation of the tree.
_southEastTree | property |
protected var _southEastTree:FlxQuadTree
Internal, governs and assists with the formation of the tree.
_southWestTree | property |
protected var _southWestTree:FlxQuadTree
Internal, governs and assists with the formation of the tree.
_tailA | property |
protected var _tailA:FlxList
Refers to the internal A and B linked lists, which are used to store objects in the leaves.
_tailB | property |
protected var _tailB:FlxList
Refers to the internal A and B linked lists, which are used to store objects in the leaves.
_topEdge | property |
protected var _topEdge:Number
Internal, governs and assists with the formation of the tree.
_useBothLists | property |
protected static var _useBothLists:Boolean
Internal, used during tree processing and overlap checks.
divisions | property |
public static var divisions:uint
Controls the granularity of the quad tree. Default is 6 (decent performance on large and small worlds).
FlxQuadTree | () | Constructor |
public function FlxQuadTree(X:Number, Y:Number, Width:Number, Height:Number, Parent:FlxQuadTree = null)
Instantiate a new Quad Tree node.
ParametersX:Number — The X-coordinate of the point in space.
| |
Y:Number — The Y-coordinate of the point in space.
| |
Width:Number — Desired width of this node.
| |
Height:Number — Desired height of this node.
| |
Parent:FlxQuadTree (default = null ) — The parent branch or node. Pass null to create a root.
|
add | () | method |
public function add(ObjectOrGroup:FlxBasic, List:uint):void
Call this function to add an object to the root of the tree. This function will recursively add all group members, but not the groups themselves.
Parameters
ObjectOrGroup:FlxBasic — FlxObjects are just added, FlxGroups are recursed and their applicable members added accordingly.
| |
List:uint — A uint flag indicating the list to which you want to add the objects. Options are A_LIST and B_LIST .
|
addObject | () | method |
protected function addObject():void
Internal function for recursively navigating and creating the tree while adding objects to the appropriate nodes.
addToList | () | method |
protected function addToList():void
Internal function for recursively adding objects to leaf lists.
destroy | () | method |
public function destroy():void
Clean up memory.
execute | () | method |
public function execute():Boolean
FlxQuadTree
's other main function. Call this after adding objects
using FlxQuadTree.load()
to compare the objects that you loaded.
Boolean — Whether or not any overlaps were found.
|
load | () | method |
public function load(ObjectOrGroup1:FlxBasic, ObjectOrGroup2:FlxBasic = null, NotifyCallback:Function = null, ProcessCallback:Function = null):void
Load objects and/or groups into the quad tree, and register notify and processing callbacks.
Parameters
ObjectOrGroup1:FlxBasic — Any object that is or extends FlxObject or FlxGroup.
| |
ObjectOrGroup2:FlxBasic (default = null ) — Any object that is or extends FlxObject or FlxGroup. If null, the first parameter will be checked against itself.
| |
NotifyCallback:Function (default = null ) — A function with the form myFunction(Object1:FlxObject,Object2:FlxObject):void that is called whenever two objects are found to overlap in world space, and either no ProcessCallback is specified, or the ProcessCallback returns true.
| |
ProcessCallback:Function (default = null ) — A function with the form myFunction(Object1:FlxObject,Object2:FlxObject):Boolean that is called whenever two objects are found to overlap in world space. The NotifyCallback is only called if this function returns true. See FlxObject.separate().
|
overlapNode | () | method |
protected function overlapNode():Boolean
An internal function for comparing an object against the contents of a node.
ReturnsBoolean — Whether or not any overlaps were found.
|
A_LIST | Constant |
public static const A_LIST:uint = 0
Flag for specifying that you want to add an object to the A list.
B_LIST | Constant |
public static const B_LIST:uint = 1
Flag for specifying that you want to add an object to the B list.