craftyjs.github.com

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.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.refresh

public void Crafty.map.remove(Entry entry)

entry
An entry to update

Refresh an entry's keys, and its position in the broad phrase map.

Example

Crafty.map.refresh(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
  }
}