Map:spawn_entities
Spawns entities necessary to display and play within this map.
This will spawn:
- One entity with:
- One drawable component per tile layer per tileset. The draw order set to
layer_index / 100. - Collider components representing the tile collision data.
- One drawable component per tile layer per tileset. The draw order set to
- One entity per Tiled object within object layers. See the Map overview for more details on how these entities are constructed.
Usage
map:spawn_entities(ecs)
Arguments
| Name | Type | Description |
|---|---|---|
ecs | ECS | ECS to spawn the entities within. |
Examples
local ecs = crystal.ECS:new();
local map = crystal.assets.get("assets/maps/dungeon.lua");
map:spawn_entities(ecs);