Package | org.flixel.system |
Class | public class FlxQuadTree |
Inheritance | FlxQuadTree ![]() ![]() |
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 | ||
---|---|---|---|
_b : Number | FlxQuadTree | ||
_canSubdivide : Boolean
Whether this branch of the tree can be subdivided or not. | FlxQuadTree | ||
_coh : Number [static] | FlxQuadTree | ||
_cow : Number [static] | FlxQuadTree | ||
_cox : Number [static] | FlxQuadTree | ||
_coy : Number [static] | FlxQuadTree | ||
_headA : FlxList
These variables refer to the internal A and B linked lists,
which are used to store objects in the leaves. | FlxQuadTree | ||
_headB : FlxList | FlxQuadTree | ||
_hh : Number | FlxQuadTree | ||
_hw : Number | FlxQuadTree | ||
_l : Number | FlxQuadTree | ||
_min : uint [static]
These variables refer to the potential child quadrants for this node. | FlxQuadTree | ||
_mx : Number | FlxQuadTree | ||
_my : Number | FlxQuadTree | ||
_ne : FlxQuadTree | FlxQuadTree | ||
_nw : FlxQuadTree | FlxQuadTree | ||
_o : FlxObject [static]
These objects are used to reduce recursive parameters internally. | FlxQuadTree | ||
_oa : uint [static] | FlxQuadTree | ||
_ob : Number [static] | FlxQuadTree | ||
_ohh : Number [static] | FlxQuadTree | ||
_ohw : Number [static] | FlxQuadTree | ||
_ohx : Number [static] | FlxQuadTree | ||
_ohy : Number [static] | FlxQuadTree | ||
_ol : Number [static] | FlxQuadTree | ||
_om : Boolean [static] | FlxQuadTree | ||
_on : Function [static] | FlxQuadTree | ||
_op : Function [static] | FlxQuadTree | ||
_or : Number [static] | FlxQuadTree | ||
_ot : Number [static] | FlxQuadTree | ||
_r : Number | FlxQuadTree | ||
_se : FlxQuadTree | FlxQuadTree | ||
_sw : FlxQuadTree | FlxQuadTree | ||
_t : Number | FlxQuadTree | ||
_tailA : FlxList | FlxQuadTree | ||
_tailB : FlxList | 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 | ||
![]() | FlxRect | ||
![]() | copyFromFlash(FlashRect:Rectangle):FlxRect | FlxRect | |
![]() | FlxRect | ||
![]() | copyToFlash(FlashRect:Rectangle):Rectangle | FlxRect | |
destroy():void | FlxQuadTree | ||
execute():Boolean
FlxQuadTree's other main function. | FlxQuadTree | ||
FlxQuadTree | |||
![]() |
Instantiate a new rectangle. | FlxRect | |
![]() |
Checks to see if some FlxObject object overlaps this FlxObject 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(Iterator:FlxList = null):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 |
_b | property |
protected var _b:Number
_canSubdivide | property |
protected var _canSubdivide:Boolean
Whether this branch of the tree can be subdivided or not.
_coh | property |
protected static var _coh:Number
_cow | property |
protected static var _cow:Number
_cox | property |
protected static var _cox:Number
_coy | property |
protected static var _coy:Number
_headA | property |
protected var _headA:FlxList
These variables refer to the internal A and B linked lists, which are used to store objects in the leaves.
_headB | property |
protected var _headB:FlxList
_hh | property |
protected var _hh:Number
_hw | property |
protected var _hw:Number
_l | property |
protected var _l:Number
_min | property |
protected static var _min:uint
These variables refer to the potential child quadrants for this node.
_mx | property |
protected var _mx:Number
_my | property |
protected var _my:Number
_ne | property |
protected var _ne:FlxQuadTree
_nw | property |
protected var _nw:FlxQuadTree
_o | property |
protected static var _o:FlxObject
These objects are used to reduce recursive parameters internally.
_oa | property |
protected static var _oa:uint
_ob | property |
protected static var _ob:Number
_ohh | property |
protected static var _ohh:Number
_ohw | property |
protected static var _ohw:Number
_ohx | property |
protected static var _ohx:Number
_ohy | property |
protected static var _ohy:Number
_ol | property |
protected static var _ol:Number
_om | property |
protected static var _om:Boolean
_on | property |
protected static var _on:Function
_op | property |
protected static var _op:Function
_or | property |
protected static var _or:Number
_ot | property |
protected static var _ot:Number
_r | property |
protected var _r:Number
_se | property |
protected var _se:FlxQuadTree
_sw | property |
protected var _sw:FlxQuadTree
_t | property |
protected var _t:Number
_tailA | property |
protected var _tailA:FlxList
_tailB | property |
protected var _tailB:FlxList
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
execute | () | method |
public function execute():Boolean
FlxQuadTree
's other main function. Call this after adding objects
using FlxQuadTree.add()
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
Parameters
ObjectOrGroup1:FlxBasic | |
ObjectOrGroup2:FlxBasic (default = null )
| |
NotifyCallback:Function (default = null )
| |
ProcessCallback:Function (default = null )
|
overlapNode | () | method |
protected function overlapNode(Iterator:FlxList = null):Boolean
An internal function for comparing an object against the contents of a node.
Parameters
Iterator:FlxList (default = null ) — An optional pointer to a linked list entry (for comparing A against itself).
|
Boolean — 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.