micro_ldtk
micro_ldtk provides a feature rich layer on top of raw LDTK JSON data, focused on the Bevy engine, and with a goal
of forward compatible support for as many LDTK schema versions as is sensible.
Installation
By default, micro_ldtk provides support for the latest LDTK schema version (for a value that also includes N-1, as
there may be some time lag between the latest LDTK version being published and a new version of micro_ldtk being
published)
To either support a different LDTK schema version, or to pin your version, you will need to disable default features and select the schema version you need:
[]
= { = "0.3.0-beta.1", = false, = ["ldtk_1_2_5", "autotile"] }
Features
autotile: Provides type conversions from LDTK projects to micro_autotileAutoRuleSetstructs. Re-exportsmicro_autotileasautotile.ldtk_1_2_5: Provides support for LDTK schema version 1.2.5ldtk_1_2_4: Provides support for LDTK schema version 1.2.4no_panic: Replaces explicitpanic!calls (unwrap, expect, panic, etc) with aborts. This can reduce WASM binary size, but may not cover all areas. PRs welcome.
Usage
First, include the plugin in your app. This will include an asset loader for LDTK files, and will create resources for indexed levels and tilesets. In the context of this README, "tilesets" refers to the metadata associated with tile IDs, and not the spritesheets or images that might be rendered to represent the tile ID.
Levels and tilesets must have globally unique names, or the last one loaded will be used.
use *;
use MicroLDTKPlugin;
Elsewhere, load one or more LDTK projects through the asset server:
use *;
use Project;
;
When LDTK projects are loaded or modified (when asset events are enabled), the levels and tilesets will be parsed into
a more ergonomic format, and stored in resources. These resources can be accessed through the LevelIndex and TilesetIndex resources.
use *;
use ;