World¶
- class punyecs.World(groups: list[tuple[punyecs.Query, list, list[typing.Callable[[typing.Any, float], NoneType]]]] = <factory>)¶
Bases:
objectAttributes Summary
Methods Summary
add(entity)Add an entity to the world.
entity_satisfies_query(entity, query)Check if an entity should (or should not) be added to a particular group by analyzing the query structure.
push_group(query)Add the group and return that group.
update(dt)Update the world (and all the corresponding groups/entities).
Attributes Documentation
- groups: list[tuple[Query, list, list[Callable[[Any, float], None]]]] = <dataclasses._MISSING_TYPE object>¶
Methods Documentation
- add(entity: Any)¶
Add an entity to the world. Under the hood, determines what groups the entity should belong to.
- Parameters:
entity – The entity to add to the world.
- entity_satisfies_query(entity, query) bool¶
Check if an entity should (or should not) be added to a particular group by analyzing the query structure.
- Parameters:
entity – The entity to query.
query – The query to check if the entity can belong to it.
- push_group(query: Query)¶
Add the group and return that group.
- Parameters:
query – The query to associate with the group.
- update(dt: float)¶
Update the world (and all the corresponding groups/entities).
- Parameters:
dt – The amount of time that elapsed. (Common for videogame applications)