Crafty.HashMap Class
Broad-phase collision detection engine. See background information at
See Also
Properties
Methods
Back to top
Crafty.HashMap.constructor
public void Crafty.HashMap([cellsize])
- cellsize
the cell size. If omitted,
cellsize
is 64.
Set cellsize
.
And create this.map
.
Back to top
Crafty.HashMap.key()
public Object Crafty.HashMap.key(Object obj[, Object keys])
- obj
an Object that has .cbr(), .mbr() or _x, _y, _w and _h.
- [keys]
optional object to reuse for the saving result in
- [Returns]
an object describing the region in grid cells the given object is located in - { x1: start col index, y1: start row index, x2: end col index, y2: end row index}
Get the rectangular region (in terms of the grid, with grid size cellsize
), where the object may fall in. This region is determined by the object's bounding box.
The cellsize
is 64 by default.