Cl Level

Level class.

Parent class: Object. Manages your game scene.

Derived from Object.

Class Level

Level:spawnObjects () Spawn all objects passed with the LevelData provided during creation.
Level:update (dt) Updates level camera, physics and all entities.
Level:draw () Draw all level layers and entities.
Level:getProperties () Get the properties table from the LevelData provided during creation.
Level:getPhysicsWorld () Get the physics world.
Level:getPixelsPerMeter () Get pixels per meter of the physics world.
Level:getCamera () Get camera object.
Level:createEntity (class) Create an entity.
Level:getEntitiesByClass (class) Get entities by class.
Level:getEntitiesByMixin (mixin) Get entities by mixin.
Level:getEntitiesWhere (func) Get entities by function filter.
Level:getAllEntities () Get all entities.


Class Level

Level:spawnObjects ()
Spawn all objects passed with the LevelData provided during creation. Emits the "SpawnLevelObject" signal with signature function( (Level) level, (table) objectData ) for every loaded object.
Level:update (dt)
Updates level camera, physics and all entities.

Parameters:

  • dt number delta time
Level:draw ()
Draw all level layers and entities.
Level:getProperties ()
Get the properties table from the LevelData provided during creation.

Returns:

    table leveldata properties
Level:getPhysicsWorld ()
Get the physics world. Requires the physics system to be active in this level.

Returns:

    World world physics world
Level:getPixelsPerMeter ()
Get pixels per meter of the physics world.

Returns:

    number pixels per meter
Level:getCamera ()
Get camera object.

Returns:

    Camera camera
Level:createEntity (class)
Create an entity.

Parameters:

  • class string entity class name

Returns:

    Entity entity
Level:getEntitiesByClass (class)
Get entities by class.

Parameters:

Returns:

    table table of entities
Level:getEntitiesByMixin (mixin)
Get entities by mixin.

Parameters:

  • mixin table mixin table

Returns:

    table table of entities
Level:getEntitiesWhere (func)
Get entities by function filter.

Parameters:

  • func func filter function (returns true or false)

Returns:

    table table of entities
Level:getAllEntities ()
Get all entities.

Returns:

    table table of entities
generated by LDoc 1.4.3 Last updated 2015-04-20 03:01:38