Functions related with querying entities.
public Object Crafty.map.insert(Object obj)
obj
is inserted in '.map' of the corresponding broad phase cells. An object of the following fields is returned.
- the object that keep track of cells (keys)
- `obj`
- the HashMap object
public Object Crafty.map.search(Object rect[, Boolean filter])
filter
is false
, just search for all the entries in the give rect
region by broad phase collision. Entity may be returned duplicated.filter
is true
, filter the above results by checking that they actually overlap rect
.
The easier usage is with filter
=true
. For performance reason, you may use filter
=false
, and filter the result yourself. See examples in drawing.js and collision.jspublic void Crafty.map.remove([Object keys, ]Object obj)
Crafty.HashMap.key
.Remove an entity in a broad phase map. - The second form is only used in Crafty.HashMap to save time for computing keys again, where keys were computed previously from obj. End users should not call this form directly.
Crafty.map.remove(e);
public void Crafty.map.remove(Entry entry)
Refresh an entry's keys, and its position in the broad phrase map.
Crafty.map.refresh(e);
public Object Crafty.map.boundaries()
The return Object
is of the following format.
{
min: {
x: val_x,
y: val_y
},
max: {
x: val_x,
y: val_y
}
}