Create an Entity¶
For reusable gameplay entities, prefer the factory/lifecycle path.
- Define or reuse a blueprint.
- Register it in your factory.
- Create a
SpawnDefinition. - Request it through the lifecycle system.
Example factory:
class GameFactory(EntityFactory):
registry = {
"circle": CircleBlueprint,
}
Definition:
"ball": SpawnDefinition(
"circle",
make_kwargs=lambda: {
"position": Vec2(100, 100),
"radius": 8,
},
)
Initial placement:
yield EntitySpawn("ball")
Runtime systems should generally request spawning through LifecycleQueue.