mini_arcade_core.engine.entities

Engine entities for mini-arcade-core.

Classes

EntityIdAllocator

Simple entity ID allocator.

BaseEntity

Base entity class.

Module Contents

class mini_arcade_core.engine.entities.EntityIdAllocator(start: int = 1000)

Simple entity ID allocator.

Parameters:

start (int) – The starting ID for allocation.

new() int

Allocate a new unique entity ID.

Returns:

The allocated entity ID.

Return type:

int

class mini_arcade_core.engine.entities.BaseEntity

Base entity class.

Variables:
  • id – The unique ID of the entity.

  • name – The optional name of the entity.

  • transform – The transform of the entity.

  • shape – The shape of the entity.

  • style – The render style of the entity.

  • kinematic – The kinematic body of the entity.

  • collider – The collider specification of the entity.

  • sprite – The sprite component of the entity.

  • anim – The animation component of the entity.

  • life – The life component of the entity.

id: int
name: str
codename: str
transform: mini_arcade_core.spaces.geometry.transform.Transform2D
shape: mini_arcade_core.spaces.geometry.shapes.Shape2D
z_index: int = 0
rotation_deg: float = 0.0
style: mini_arcade_core.engine.render.style.RenderStyle | None = None
kinematic: mini_arcade_core.spaces.physics.kinematics2d.Kinematic2D | None = None
collider: mini_arcade_core.spaces.collision.specs.ColliderSpec | None = None
sprite: mini_arcade_core.engine.components.Sprite2D | None = None
anim: mini_arcade_core.engine.components.Anim2D | None = None
life: mini_arcade_core.engine.components.Life | None = None
classmethod from_dict(data: dict) BaseEntity

Create an entity from a dictionary.

Parameters:

data (dict) – The dictionary containing the entity data.

Returns:

The created entity.

Return type:

BaseEntity