Grid Representation: factories¶
Convenience factory functions for building Entity objects.
Each helper returns a preconfigured Entity with a common pattern
(agent, floor, wall, coin, key, door, portal, hazards, effects, etc.). These
are mutable blueprints that can be converted into an immutable ECS
grid_universe.state.State via grid_universe.grid.convert.to_state.
create_agent(health=5)
¶
Player-controlled agent with health + inventory + empty status.
create_box(pushable=True, moving_direction=None, moving_on_collision='bounce', moving_speed=1)
¶
Pushable / blocking box (optionally not pushable).
create_coin(reward=None)
¶
Collectible coin awarding optional score when picked up.
create_core(reward=None, required=True)
¶
Key objective collectible ("core") optionally giving reward.
create_door(key_id)
¶
Locked door requiring a key with the same id.
create_exit()
¶
Exit tile used in objectives.
create_floor(cost_amount=1)
¶
Background floor tile with movement cost.
create_hazard(appearance, damage, lethal=False, priority=7)
¶
Static damaging (optionally lethal) tile-like hazard.
create_immunity_effect(time=None, usage=None)
¶
Collectible immunity effect (optional limits).
create_key(key_id)
¶
Key item unlocking doors with matching key_id.
create_monster(damage=3, lethal=False, *, moving_direction=None, moving_on_collision='bounce', moving_speed=1, pathfind_target=None, path_type=PathfindingType.PATH)
¶
Basic enemy with damage and optional lethal + pathfinding target.
create_phasing_effect(time=None, usage=None)
¶
Collectible phasing effect (optional limits).
create_portal(*, pair=None)
¶
Portal endpoint (optionally auto-paired by reference).
If pair is provided we set reciprocal refs so conversion wires the
pair entities with each other's id.
create_speed_effect(multiplier, time=None, usage=None)
¶
Collectible speed effect (optional time / usage limits).
create_wall()
¶
Blocking wall tile.