Package | net.flashpunk.masks |
Class | public class Grid |
Inheritance | Grid Hitbox Mask Object |
Property | Defined By | ||
---|---|---|---|
columns : uint [read-only]
How many columns the grid has
| Grid | ||
data : BitmapData [read-only]
The grid data. | Grid | ||
height : int
Height. | Hitbox | ||
list : Masklist
The parent Masklist of the mask. | Mask | ||
parent : Entity
The parent Entity of this mask. | Mask | ||
rows : uint [read-only]
How many rows the grid has. | Grid | ||
tileHeight : uint [read-only]
The tile height. | Grid | ||
tileWidth : uint [read-only]
The tile width. | Grid | ||
usePositions : Boolean
If x/y positions should be used instead of columns/rows. | Grid | ||
width : int
Width. | Hitbox | ||
x : int
X offset. | Hitbox | ||
y : int
Y offset. | Hitbox |
Method | Defined By | ||
---|---|---|---|
Grid(width:uint, height:uint, tileWidth:uint, tileHeight:uint, x:int = 0, y:int = 0)
Constructor. | Grid | ||
clearRect(column:uint = 0, row:uint = 0, width:int = 1, height:int = 1):void
Makes the rectangular region of tiles non-solid. | Grid | ||
clearTile(column:uint = 0, row:uint = 0):void
Makes the tile non-solid. | Grid | ||
Checks for collision with another Mask. | Mask | ||
getTile(column:uint = 0, row:uint = 0):Boolean
Gets the value of a tile. | Grid | ||
loadFromString(str:String, columnSep:String = ,, rowSep:String = ):void
Loads the grid data from a string. | Grid | ||
renderDebug(g:Graphics):void [override] | Grid | ||
saveToString(columnSep:String = ,, rowSep:String = ):String
Saves the grid data to a string. | Grid | ||
setRect(column:uint = 0, row:uint = 0, width:int = 1, height:int = 1, solid:Boolean = true):void
Sets the value of a rectangle region of tiles. | Grid | ||
setTile(column:uint = 0, row:uint = 0, solid:Boolean = true):void
Sets the value of the tile. | Grid | ||
update():void [override] | Hitbox |
columns | property |
columns:uint
[read-only] How many columns the grid has
public function get columns():uint
data | property |
data:BitmapData
[read-only] The grid data.
public function get data():BitmapData
rows | property |
rows:uint
[read-only] How many rows the grid has.
public function get rows():uint
tileHeight | property |
tileHeight:uint
[read-only] The tile height.
public function get tileHeight():uint
tileWidth | property |
tileWidth:uint
[read-only] The tile width.
public function get tileWidth():uint
usePositions | property |
public var usePositions:Boolean
If x/y positions should be used instead of columns/rows.
Grid | () | Constructor |
public function Grid(width:uint, height:uint, tileWidth:uint, tileHeight:uint, x:int = 0, y:int = 0)
Constructor.
Parameterswidth:uint — Width of the grid, in pixels.
| |
height:uint — Height of the grid, in pixels.
| |
tileWidth:uint — Width of a grid tile, in pixels.
| |
tileHeight:uint — Height of a grid tile, in pixels.
| |
x:int (default = 0 ) — X offset of the grid.
| |
y:int (default = 0 ) — Y offset of the grid.
|
clearRect | () | method |
public function clearRect(column:uint = 0, row:uint = 0, width:int = 1, height:int = 1):void
Makes the rectangular region of tiles non-solid.
Parameters
column:uint (default = 0 ) — First column.
| |
row:uint (default = 0 ) — First row.
| |
width:int (default = 1 ) — Columns to fill.
| |
height:int (default = 1 ) — Rows to fill.
|
clearTile | () | method |
public function clearTile(column:uint = 0, row:uint = 0):void
Makes the tile non-solid.
Parameters
column:uint (default = 0 ) — Tile column.
| |
row:uint (default = 0 ) — Tile row.
|
getTile | () | method |
public function getTile(column:uint = 0, row:uint = 0):Boolean
Gets the value of a tile.
Parameters
column:uint (default = 0 ) — Tile column.
| |
row:uint (default = 0 ) — Tile row.
|
Boolean — tile value.
|
loadFromString | () | method |
public function loadFromString(str:String, columnSep:String = ,, rowSep:String = ):void
Loads the grid data from a string.
Parameters
str:String — The string data, which is a set of tile values (0 or 1) separated by the columnSep and rowSep strings.
| |
columnSep:String (default = , ) — The string that separates each tile value on a row, default is ",".
| |
rowSep:String (default = ) — The string that separates each row of tiles, default is "\n".
|
renderDebug | () | method |
override public function renderDebug(g:Graphics):void
Parameters
g:Graphics |
saveToString | () | method |
public function saveToString(columnSep:String = ,, rowSep:String = ):String
Saves the grid data to a string.
Parameters
columnSep:String (default = , ) — The string that separates each tile value on a row, default is ",".
| |
rowSep:String (default = ) — The string that separates each row of tiles, default is "\n".
|
String |
setRect | () | method |
public function setRect(column:uint = 0, row:uint = 0, width:int = 1, height:int = 1, solid:Boolean = true):void
Sets the value of a rectangle region of tiles.
Parameters
column:uint (default = 0 ) — First column.
| |
row:uint (default = 0 ) — First row.
| |
width:int (default = 1 ) — Columns to fill.
| |
height:int (default = 1 ) — Rows to fill.
| |
solid:Boolean (default = true ) — If the tiles should be solid.
|
setTile | () | method |
public function setTile(column:uint = 0, row:uint = 0, solid:Boolean = true):void
Sets the value of the tile.
Parameters
column:uint (default = 0 ) — Tile column.
| |
row:uint (default = 0 ) — Tile row.
| |
solid:Boolean (default = true ) — If the tile should be solid.
|