Constructor
new GameWorld()
Constructor of the World instance. Invoked by Lance on startup.
- Source:
Methods
forEachObject(callback)
World object iterator. Invoke callback(objId, obj) for each object
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | function receives id and object. If callback returns false, the iteration will cease |
- Source:
queryObject(query) → {Object}
Returns The first game object encountered which matches a criteria.
Syntactic sugar for queryObjects with returnSingle: true
Parameters:
Name | Type | Description |
---|---|---|
query |
Object | See queryObjects |
- Source:
Returns:
The game object, if found
- Type
- Object
queryObjects(query) → {Array|Object}
Returns all the game world objects which match a criteria
Parameters:
Name | Type | Description | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
query |
Object | The query object Properties
|
- Source:
Returns:
All game objects which match all the query parameters, or the first match if returnSingle was specified
- Type
- Array | Object