world
The world object is the core of Pyxen’s entity system. It manages entity lifecycle, component storage, and queries.
See also: Game Loop.
Entity Lifecycle
Spawn
e = world.spawn(name="enemy", x=100, y=50)
Creates a new entity with optional components.
See: spawn()
Destroy
world.destroy(e)
Removes an entity and all of its components.
See: destroy()
Queries
world.all()
for e in world.all("enemy", without=("dead",)):
...
Returns an iterator over entities matching required components.
See: world.all()
Lookup
world.get()
Retrieve an entity by name.
player = world.get(name="player")
If multiple entities share the same name, the one with the lowest entity ID is returned.
See: world.get()
Spatial Systems
GridMap
Attach a spatial grid container to an entity.
e.map = GridMap(rows=10, columns=10, size=(16,16))
See: GridMap
GridBody
Attach grid-based collision and movement.
e.body = GridBody(...)
See: GridBody