Crafty.map
Functions related with querying entities.
See Also
Back to top
Crafty.map.insert
public Object Crafty.map.insert(Object obj)
- obj
- An entity to be inserted.
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
Back to top
Crafty.map.search
public Object Crafty.map.search(Object rect[, Boolean filter])
- rect
- the rectangular region to search for entities.
- filter
- Default value is true. Otherwise, must be false.
- If
filterisfalse, just search for all the entries in the giverectregion by broad phase collision. Entity may be returned duplicated. - If
filteristrue, filter the above results by checking that they actually overlaprect. The easier usage is withfilter=true. For performance reason, you may usefilter=false, and filter the result yourself. See examples in drawing.js and collision.js
Back to top
Crafty.map.remove
public void Crafty.map.remove([Object keys, ]Object obj)
- keys
- key region. If omitted, it will be derived from obj by
Crafty.HashMap.key. - obj
- need more document.
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.
Example
Crafty.map.remove(e);
Back to top
Crafty.map.boundaries
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
}
}

@craftyjs
#crafty@freenode.net
google groups
louis@craftyjs.com
github