Packagecom.whirled.contrib.platformer.util
Classpublic class SectionalIndex

A utility that indexes a first quadrant space into equal sized areas.



Protected Properties
 PropertyDefined by
  _maxWidth : int
SectionalIndex
  _secHeight : int
SectionalIndex
  _secWidth : int
SectionalIndex
Public Methods
 MethodDefined by
  
SectionalIndex(secWidth:int, secHeight:int, maxWidth:int = 1000)
SectionalIndex
  
getLocalX(sx:int):int
Converts a global x value to the local x value in a section.
SectionalIndex
  
getLocalY(sy:int):int
Converts a global y value to the local y value in a section.
SectionalIndex
  
getSectionFromTile(tx:int, ty:int):int
Returns the section index for the supplied global coordinates.
SectionalIndex
  
The display height of a section.
SectionalIndex
  
getSectionIndex(sx:int, sy:int):int
Returns the index for the supplied section.
SectionalIndex
  
The display width of a section.
SectionalIndex
  
getSectionX(section:int):int
Returns the section x coordinate from a section index.
SectionalIndex
  
getSectionXFromTile(tx:int):int
Returns the x value of the section this global x value resides in.
SectionalIndex
  
getSectionY(section:int):int
Returns the section y coordinate from a section index.
SectionalIndex
  
getSectionYFromTile(ty:int):int
Returns the y value of the section this global y value resides in.
SectionalIndex
  
validX(x:int):Boolean
Returns true if this x value is inside the area being indexed.
SectionalIndex
  
validY(y:int):Boolean
Returns true if this y value is inside the area being indexed.
SectionalIndex
Property detail
_maxWidthproperty
protected var _maxWidth:int
_secHeightproperty 
protected var _secHeight:int
_secWidthproperty 
protected var _secWidth:int
Constructor detail
SectionalIndex()constructor
public function SectionalIndex(secWidth:int, secHeight:int, maxWidth:int = 1000)Parameters
secWidth:int
 
secHeight:int
 
maxWidth:int (default = 1000)
Method detail
getLocalX()method
public function getLocalX(sx:int):int

Converts a global x value to the local x value in a section.

Parameters
sx:int

Returns
int
getLocalY()method 
public function getLocalY(sy:int):int

Converts a global y value to the local y value in a section.

Parameters
sy:int

Returns
int
getSectionFromTile()method 
public function getSectionFromTile(tx:int, ty:int):int

Returns the section index for the supplied global coordinates.

Parameters
tx:int
 
ty:int

Returns
int
getSectionHeight()method 
public function getSectionHeight():int

The display height of a section.

Returns
int
getSectionIndex()method 
public function getSectionIndex(sx:int, sy:int):int

Returns the index for the supplied section.

Parameters
sx:int
 
sy:int

Returns
int
getSectionWidth()method 
public function getSectionWidth():int

The display width of a section.

Returns
int
getSectionX()method 
public function getSectionX(section:int):int

Returns the section x coordinate from a section index.

Parameters
section:int

Returns
int
getSectionXFromTile()method 
public function getSectionXFromTile(tx:int):int

Returns the x value of the section this global x value resides in.

Parameters
tx:int

Returns
int
getSectionY()method 
public function getSectionY(section:int):int

Returns the section y coordinate from a section index.

Parameters
section:int

Returns
int
getSectionYFromTile()method 
public function getSectionYFromTile(ty:int):int

Returns the y value of the section this global y value resides in.

Parameters
ty:int

Returns
int
validX()method 
public function validX(x:int):Boolean

Returns true if this x value is inside the area being indexed.

Parameters
x:int

Returns
Boolean
validY()method 
public function validY(y:int):Boolean

Returns true if this y value is inside the area being indexed.

Parameters
y:int

Returns
Boolean