class documentation

class Level(engine.Level):

View In Hierarchy

Represent a game level containing entities and rendering state.

Methods

  • clear()
    Clear the level's non-player entities.
  • entity_add(entity)
    Add an entity to the level.
  • entity_remove(entity)
    Remove an entity from the level.
  • set_name(name)
    Set the level name.
  • set_size(size)
    Set the level world size.
  • set_clear_allowed(clear_allowed)
    Set whether clearing is allowed.
  • set_light_direction(x, y, z)
    Set the 3D lighting direction.
  • set_shadow_color(color)
    Set the 3D shadow color.
  • get_entity(index)
    Return an entity by index.
  • render_3d_sprite(path, view_height=0.0, clamp=False, wireframe=True)
    Render a file-backed 3D sprite for the player.
  • __del__()
    Release the native level resources.
Parameters
nameLevel name.
sizeLevel world size.
gameGame that owns the level.
startCallback called when the level starts. Defaults to None.
stopCallback called when the level stops. Defaults to None.
Method __setattr__ Set a level attribute, routing to the matching setter.
Instance Variable clear_allowed Whether level clearing is allowed. Writable.
Instance Variable entity_count Number of entities in the level. Read-only.
Instance Variable name Level name. Writable.
Instance Variable size Level world size. Writable.
def __setattr__(self, name, value):

Set a level attribute, routing to the matching setter.

Parameters
name:strAttribute name to set.
value:objectNew value for the attribute.
clear_allowed: bool =

Whether level clearing is allowed. Writable.

entity_count: int =

Number of entities in the level. Read-only.

name: str =

Level name. Writable.

size: Vector =

Level world size. Writable.