diff --git a/CHANGELOG.md b/CHANGELOG.md index f17856bd..1366ee92 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,92 @@ # Changelog +## [0.9.0](https://github.com/Trouv/bevy_ecs_ldtk/compare/v0.8.0...v0.9.0) (2024-02-11) + + +### ⚠ BREAKING CHANGES + +* upgrade to bevy 0.12 ([#265](https://github.com/Trouv/bevy_ecs_ldtk/issues/265)) +* upgrade to LDtk 1.5.3, dropping support for previous versions ([#295](https://github.com/Trouv/bevy_ecs_ldtk/issues/295)) +* add `SpawnExclusions` to `LdtkSettings` for skipping layers by identifier ([#275](https://github.com/Trouv/bevy_ecs_ldtk/issues/275)) +* add layer entity for Entity layers, changing the hierarchy ([#257](https://github.com/Trouv/bevy_ecs_ldtk/issues/257)) +* upgrade to LDtk types and examples to 1.4.1 (drop support for <1.4.1) ([#256](https://github.com/Trouv/bevy_ecs_ldtk/issues/256)) +* LdtkLevel renamed to LdtkExternalLevel and is no longer used as a component ([#244](https://github.com/Trouv/bevy_ecs_ldtk/issues/244)) +* redesign LdtkProject with better level data accessors and correct modeling of internal/external levels ([#244](https://github.com/Trouv/bevy_ecs_ldtk/issues/244)) +* use the bundle's `Default` implementation rather than the field's in `LdtkEntity` and `LdtkIntCell` derive macros ([#222](https://github.com/Trouv/bevy_ecs_ldtk/issues/222)) +* add `RawLevelAccessor` trait for `LdtkJson` level borrowing/iteration, replacing existing methods ([#225](https://github.com/Trouv/bevy_ecs_ldtk/issues/225)) +* add `LevelIndices` type defining a level's location in a project and use it in `LevelSelection::Indices` ([#221](https://github.com/Trouv/bevy_ecs_ldtk/issues/221)) +* change `LevelEvent` inner types from `String` to `LevelIid` ([#219](https://github.com/Trouv/bevy_ecs_ldtk/issues/219)) +* change `LevelSet` inner type from `String` to `LevelIid` ([#219](https://github.com/Trouv/bevy_ecs_ldtk/issues/219)) +* change `LevelSelection::Iid` inner type from `String` to `LevelIid` ([#219](https://github.com/Trouv/bevy_ecs_ldtk/issues/219)) +* replace `LevelSet::from_iid` with `LevelSet::from_iids`, which can convert from any collection of strings. ([#219](https://github.com/Trouv/bevy_ecs_ldtk/issues/219)) +* use new LevelIid type in LevelEvent, LevelSet, and LevelSelection, plus other improvements ([#219](https://github.com/Trouv/bevy_ecs_ldtk/issues/219)) +* `LdtkProject::project` and `LdtkLevel::level` fields have both been renamed to `data` ([#206](https://github.com/Trouv/bevy_ecs_ldtk/issues/206)) +* All fields of `LdtkProject` and `LdtkLevel` are now privatized, and have immutable getter methods ([#206](https://github.com/Trouv/bevy_ecs_ldtk/issues/206)) +* `LevelMap` and `TilesetMap` type aliases have been removed ([#206](https://github.com/Trouv/bevy_ecs_ldtk/issues/206)) +* `LdtkAsset` and `LdtkProject` are now exported in new `assets` module instead of `lib.rs` ([#206](https://github.com/Trouv/bevy_ecs_ldtk/issues/206)) +* asset `Loader` types are now private ([#206](https://github.com/Trouv/bevy_ecs_ldtk/issues/206)) +* `LdtkAsset` renamed to `LdtkProject` ([#206](https://github.com/Trouv/bevy_ecs_ldtk/issues/206)) + +### Features + +* add `LevelIndices` type defining a level's location in a project and use it in `LevelSelection::Indices` ([#221](https://github.com/Trouv/bevy_ecs_ldtk/issues/221)) ([59618fe](https://github.com/Trouv/bevy_ecs_ldtk/commit/59618fe2f406caddd433ec435cff0a2156775c5c)) +* add `RawLevelAccessor` trait for `LdtkJson` level borrowing/iteration, replacing existing methods ([#225](https://github.com/Trouv/bevy_ecs_ldtk/issues/225)) ([d3de2d9](https://github.com/Trouv/bevy_ecs_ldtk/commit/d3de2d9d4079865d110af57016258f67ac3f3de8)) +* add `SpawnExclusions` to `LdtkSettings` for skipping layers by identifier ([#275](https://github.com/Trouv/bevy_ecs_ldtk/issues/275)) ([282404d](https://github.com/Trouv/bevy_ecs_ldtk/commit/282404d1f472ce2d31fef52d2943525fe1e045b0)), closes [#272](https://github.com/Trouv/bevy_ecs_ldtk/issues/272) +* add layer entity for Entity layers, changing the hierarchy ([#257](https://github.com/Trouv/bevy_ecs_ldtk/issues/257)) ([ee20a53](https://github.com/Trouv/bevy_ecs_ldtk/commit/ee20a53d39aafc282008ed03fb1cf3355f62dd5a)) +* add LdtkJsonWithMetadata type for representing internal- and external-level project data with generics ([#242](https://github.com/Trouv/bevy_ecs_ldtk/issues/242)) ([630434a](https://github.com/Trouv/bevy_ecs_ldtk/commit/630434a417eec89bed2dc1c5076a62e8ca46ca96)) +* add LdtkProjectData for representing either internal- or external-level project data concretely ([#243](https://github.com/Trouv/bevy_ecs_ldtk/issues/243)) ([c530bc9](https://github.com/Trouv/bevy_ecs_ldtk/commit/c530bc975dc055eff3df0f799d12d50c132a9945)) +* add level locale types and begin splitting internal_levels and external_levels features ([#237](https://github.com/Trouv/bevy_ecs_ldtk/issues/237)) ([8129e55](https://github.com/Trouv/bevy_ecs_ldtk/commit/8129e5564e52cbe971efe36e0d33fdb5a2b316fa)) +* add LevelIid component and spawn it on every level ([#215](https://github.com/Trouv/bevy_ecs_ldtk/issues/215)) ([ad83455](https://github.com/Trouv/bevy_ecs_ldtk/commit/ad834552400ae5b21ff51ae2e4d9f4651e2c82c1)) +* add LoadedLevel type that wraps around levels with complete data ([#214](https://github.com/Trouv/bevy_ecs_ldtk/issues/214)) ([3d40c15](https://github.com/Trouv/bevy_ecs_ldtk/commit/3d40c158584f68ea65dbfd36744b07fc5b656163)) +* add types and traits around LevelMetadata ([#229](https://github.com/Trouv/bevy_ecs_ldtk/issues/229)) ([382dea2](https://github.com/Trouv/bevy_ecs_ldtk/commit/382dea23407b9ebeffd9eacbc76db6018076cd3a)) +* change `LevelEvent` inner types from `String` to `LevelIid` ([#219](https://github.com/Trouv/bevy_ecs_ldtk/issues/219)) ([0039ed7](https://github.com/Trouv/bevy_ecs_ldtk/commit/0039ed757bf6a54c74d912bc43fa4165ada17bbb)) +* change `LevelSelection::Iid` inner type from `String` to `LevelIid` ([#219](https://github.com/Trouv/bevy_ecs_ldtk/issues/219)) ([0039ed7](https://github.com/Trouv/bevy_ecs_ldtk/commit/0039ed757bf6a54c74d912bc43fa4165ada17bbb)) +* change `LevelSet` inner type from `String` to `LevelIid` ([#219](https://github.com/Trouv/bevy_ecs_ldtk/issues/219)) ([0039ed7](https://github.com/Trouv/bevy_ecs_ldtk/commit/0039ed757bf6a54c74d912bc43fa4165ada17bbb)) +* LdtkLevel renamed to LdtkExternalLevel and is no longer used as a component ([#244](https://github.com/Trouv/bevy_ecs_ldtk/issues/244)) ([670cd4e](https://github.com/Trouv/bevy_ecs_ldtk/commit/670cd4e6b704a4748ab41070742733004f1686f9)) +* redesign LdtkProject with better level data accessors and correct modeling of internal/external levels ([#244](https://github.com/Trouv/bevy_ecs_ldtk/issues/244)) ([670cd4e](https://github.com/Trouv/bevy_ecs_ldtk/commit/670cd4e6b704a4748ab41070742733004f1686f9)) +* replace `LevelSet::from_iid` with `LevelSet::from_iids`, which can convert from any collection of strings. ([#219](https://github.com/Trouv/bevy_ecs_ldtk/issues/219)) ([0039ed7](https://github.com/Trouv/bevy_ecs_ldtk/commit/0039ed757bf6a54c74d912bc43fa4165ada17bbb)) +* upgrade to bevy 0.12 ([#265](https://github.com/Trouv/bevy_ecs_ldtk/issues/265)) ([194731e](https://github.com/Trouv/bevy_ecs_ldtk/commit/194731e681727ef8344e7973ade3809ad36d8e8b)) +* upgrade to LDtk 1.5.3, dropping support for previous versions ([#295](https://github.com/Trouv/bevy_ecs_ldtk/issues/295)) ([4926a50](https://github.com/Trouv/bevy_ecs_ldtk/commit/4926a50ec0eb37ac3e2ab57a83a5aebcf59d3bf3)) +* upgrade to LDtk types and examples to 1.4.1 (drop support for <1.4.1) ([#256](https://github.com/Trouv/bevy_ecs_ldtk/issues/256)) ([ab21e2c](https://github.com/Trouv/bevy_ecs_ldtk/commit/ab21e2c35e0851d06e1881dc8027d30dd891992e)) +* use new LevelIid type in LevelEvent, LevelSet, and LevelSelection, plus other improvements ([#219](https://github.com/Trouv/bevy_ecs_ldtk/issues/219)) ([0039ed7](https://github.com/Trouv/bevy_ecs_ldtk/commit/0039ed757bf6a54c74d912bc43fa4165ada17bbb)) +* use the bundle's `Default` implementation rather than the field's in `LdtkEntity` and `LdtkIntCell` derive macros ([#222](https://github.com/Trouv/bevy_ecs_ldtk/issues/222)) ([f003127](https://github.com/Trouv/bevy_ecs_ldtk/commit/f003127901c9bb724e8c4f079e54861c1f667ff5)) + + +### Bug Fixes + +* don't apply level set until project and dependencies are completely loaded ([#296](https://github.com/Trouv/bevy_ecs_ldtk/issues/296)) ([dbfe1c6](https://github.com/Trouv/bevy_ecs_ldtk/commit/dbfe1c691035f5cc983bf189b44a53cbf6705389)) +* normalize resolved asset paths using `path_clean` ([#255](https://github.com/Trouv/bevy_ecs_ldtk/issues/255)) ([33a8998](https://github.com/Trouv/bevy_ecs_ldtk/commit/33a89982545199342875c4f4e11fa53e497686b6)), closes [#240](https://github.com/Trouv/bevy_ecs_ldtk/issues/240) +* only spawn invisible tiles on first sub-layer of AutoTile+IntGrid layers ([#231](https://github.com/Trouv/bevy_ecs_ldtk/issues/231)) ([d2873e3](https://github.com/Trouv/bevy_ecs_ldtk/commit/d2873e35cce8e91a24c3800b84d57d2de0978874)) +* recalculate layer offset to adjust for tileset sizes ([#254](https://github.com/Trouv/bevy_ecs_ldtk/issues/254)) ([c00085d](https://github.com/Trouv/bevy_ecs_ldtk/commit/c00085db89c524a6c77f1ee6525d9c6678406631)) +* use entity definition tile size instead of entity instance tile size as basis when calculating ldtk entity scale ([#271](https://github.com/Trouv/bevy_ecs_ldtk/issues/271)) ([833af01](https://github.com/Trouv/bevy_ecs_ldtk/commit/833af011adb583ce379c3cd1479adabf2c9dfcce)) + + +### Documentation Changes + +* add 0.8 to 0.9 migration guide ([#266](https://github.com/Trouv/bevy_ecs_ldtk/issues/266)) ([bb91660](https://github.com/Trouv/bevy_ecs_ldtk/commit/bb9166036ca0e21d5afbdf0b7df64b014a77f514)) +* add collectathon cargo example ([#288](https://github.com/Trouv/bevy_ecs_ldtk/issues/288)) ([32dfb85](https://github.com/Trouv/bevy_ecs_ldtk/commit/32dfb85e095fa16d450d96bab2af622738e0ea63)) +* add mdbook with outline and introduction ([#261](https://github.com/Trouv/bevy_ecs_ldtk/issues/261)) ([810b25a](https://github.com/Trouv/bevy_ecs_ldtk/commit/810b25aa7b3782467adcbe25225fc9f33ec2936d)) +* add tile-based game example w/ a tutorial in the book, replacing getting-started guide ([#269](https://github.com/Trouv/bevy_ecs_ldtk/issues/269)) ([2d43efa](https://github.com/Trouv/bevy_ecs_ldtk/commit/2d43efa28814cf25e012d7a4e5f9aea17008aaa5)) +* document all-features in docs.rs ([#252](https://github.com/Trouv/bevy_ecs_ldtk/issues/252)) ([321bb07](https://github.com/Trouv/bevy_ecs_ldtk/commit/321bb07caeaba5cca1d98e81695eecd0292a9f7a)) +* reference book in API ref and README.md, replacing redundant sections ([#282](https://github.com/Trouv/bevy_ecs_ldtk/issues/282)) ([e7afdad](https://github.com/Trouv/bevy_ecs_ldtk/commit/e7afdad79d4526b892fd457a596084ce805369c5)) +* remove README.md caveat for hot reloading external levels ([#253](https://github.com/Trouv/bevy_ecs_ldtk/issues/253)) ([59eb6b3](https://github.com/Trouv/bevy_ecs_ldtk/commit/59eb6b3e4404060ce354a754b1392809742ba0e2)) +* write *Anatomy of the World* chapter of book ([#285](https://github.com/Trouv/bevy_ecs_ldtk/issues/285)) ([29d5e33](https://github.com/Trouv/bevy_ecs_ldtk/commit/29d5e33e95c692f35b0413adafd0ce20d830bdc1)) +* write *Create bevy relations from ldtk entity references* chapter of book ([#287](https://github.com/Trouv/bevy_ecs_ldtk/issues/287)) ([8080f24](https://github.com/Trouv/bevy_ecs_ldtk/commit/8080f24b401df200dccf4c7840905b36b84f10b8)) +* write *Game Logic Integration* chapter of the book ([#279](https://github.com/Trouv/bevy_ecs_ldtk/issues/279)) ([a62a556](https://github.com/Trouv/bevy_ecs_ldtk/commit/a62a556c2f84d7eafe3ab541725347879b34ecdc)) +* write *Level Selection* chapter of book ([#284](https://github.com/Trouv/bevy_ecs_ldtk/issues/284)) ([226c60c](https://github.com/Trouv/bevy_ecs_ldtk/commit/226c60c1e7e27fb32ea6cc9de6f68432b867f537)) +* write *Make level selection follow player* chapter of book ([#293](https://github.com/Trouv/bevy_ecs_ldtk/issues/293)) ([201d908](https://github.com/Trouv/bevy_ecs_ldtk/commit/201d908ae3e4f3deeb40de228f234c414c6b3141)) +* write *Respawn levels and worlds* chapter of book ([#289](https://github.com/Trouv/bevy_ecs_ldtk/issues/289)) ([55ed30f](https://github.com/Trouv/bevy_ecs_ldtk/commit/55ed30f203a1cffeccc562f54ae797e23b299c89)) + + +### Code Refactors + +* `LdtkAsset` and `LdtkProject` are now exported in new `assets` module instead of `lib.rs` ([#206](https://github.com/Trouv/bevy_ecs_ldtk/issues/206)) ([fe44774](https://github.com/Trouv/bevy_ecs_ldtk/commit/fe44774c69cc639ecdb710af593a748744a1810d)) +* `LdtkAsset` renamed to `LdtkProject` ([#206](https://github.com/Trouv/bevy_ecs_ldtk/issues/206)) ([fe44774](https://github.com/Trouv/bevy_ecs_ldtk/commit/fe44774c69cc639ecdb710af593a748744a1810d)) +* `LdtkProject::project` and `LdtkLevel::level` fields have both been renamed to `data` ([#206](https://github.com/Trouv/bevy_ecs_ldtk/issues/206)) ([fe44774](https://github.com/Trouv/bevy_ecs_ldtk/commit/fe44774c69cc639ecdb710af593a748744a1810d)) +* `LevelMap` and `TilesetMap` type aliases have been removed ([#206](https://github.com/Trouv/bevy_ecs_ldtk/issues/206)) ([fe44774](https://github.com/Trouv/bevy_ecs_ldtk/commit/fe44774c69cc639ecdb710af593a748744a1810d)) +* All fields of `LdtkProject` and `LdtkLevel` are now privatized, and have immutable getter methods ([#206](https://github.com/Trouv/bevy_ecs_ldtk/issues/206)) ([fe44774](https://github.com/Trouv/bevy_ecs_ldtk/commit/fe44774c69cc639ecdb710af593a748744a1810d)) +* asset `Loader` types are now private ([#206](https://github.com/Trouv/bevy_ecs_ldtk/issues/206)) ([fe44774](https://github.com/Trouv/bevy_ecs_ldtk/commit/fe44774c69cc639ecdb710af593a748744a1810d)) + ## [0.8.0](https://github.com/Trouv/bevy_ecs_ldtk/compare/v0.7.0...v0.8.0) (2023-07-31) diff --git a/Cargo.toml b/Cargo.toml index de1e69cd..e1ade0b1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bevy_ecs_ldtk" description = "An ECS-friendly ldtk plugin for bevy." -version = "0.8.0" +version = "0.9.0" edition = "2021" authors = ["Trevor Lovell "] repository = "https://github.com/Trouv/bevy_ecs_ldtk" @@ -14,7 +14,7 @@ exclude = ["assets/*", "repo/*", "scripts/*"] members = ["macros"] [dependencies] -bevy_ecs_ldtk_macros = { version = "0.8.0", optional = true, path = "macros" } +bevy_ecs_ldtk_macros = { version = "0.9.0", optional = true, path = "macros" } bevy_ecs_tilemap = { version = "0.12", default-features = false } bevy = { version = "0.12", default-features = false, features = ["bevy_sprite"] } derive-getters = "0.3.0" diff --git a/README.md b/README.md index 686d2af2..227da814 100644 --- a/README.md +++ b/README.md @@ -30,13 +30,13 @@ For less common use cases, strategies that leverage this plugin's ECS constructs ## Documentation Documentation for this plugin is available in two main places. -- API reference on [docs.rs](https://docs.rs/bevy_ecs_ldtk/0.8.0/bevy_ecs_ldtk/) -- Tutorials, Explanation, and Guides in the [`bevy_ecs_ldtk` book](https://trouv.github.io/bevy_ecs_ldtk/v0.8.0/index.html) +- API reference on [docs.rs](https://docs.rs/bevy_ecs_ldtk/0.9.0/bevy_ecs_ldtk/) +- Tutorials, Explanation, and Guides in the [`bevy_ecs_ldtk` book](https://trouv.github.io/bevy_ecs_ldtk/v0.9.0/index.html) In the book, the following chapters are good jumping-off points for beginners: -- [*Tile-based Game* tutorial](https://trouv.github.io/bevy_ecs_ldtk/v0.8.0/tutorials/tile-based-game/index.html) -- [*Level Selection* explanation](https://trouv.github.io/bevy_ecs_ldtk/v0.8.0/explanation/level-selection.html) -- [*Game Logic Integration* explanation](https://trouv.github.io/bevy_ecs_ldtk/v0.8.0/explanation/game-logic-integration.html) +- [*Tile-based Game* tutorial](https://trouv.github.io/bevy_ecs_ldtk/v0.9.0/tutorials/tile-based-game/index.html) +- [*Level Selection* explanation](https://trouv.github.io/bevy_ecs_ldtk/v0.9.0/explanation/level-selection.html) +- [*Game Logic Integration* explanation](https://trouv.github.io/bevy_ecs_ldtk/v0.9.0/explanation/game-logic-integration.html) Cargo examples are also available in this repository: ```sh diff --git a/book/src/README.md b/book/src/README.md index 0b550059..bdd70b1c 100644 --- a/book/src/README.md +++ b/book/src/README.md @@ -32,7 +32,7 @@ Some resources for learning Bevy include those listed on the [Bevy website](http LDtk also provides documentation on [its website](https://ldtk.io/docs/). `bevy_ecs_ldtk`'s [source code](https://github.com/Trouv/bevy_ecs_ldtk) is available on github. -This repository also contains [cargo examples](https://github.com/Trouv/bevy_ecs_ldtk/tree/v0.8.0/examples), which can be run after cloning the repository using `$ cargo run --example example-name`. +This repository also contains [cargo examples](https://github.com/Trouv/bevy_ecs_ldtk/tree/v0.9.0/examples), which can be run after cloning the repository using `$ cargo run --example example-name`. These examples may be difficult to follow on their own, and many of their strategies are described in this book. When viewing these examples, be careful to checkout the correct git tag for the version of the plugin you are using. Some changes may have been made to the plugin or to the examples on the `main` branch that are not released yet, and trying to apply these to the version of the plugin you are using can lead to errors. diff --git a/book/src/explanation/anatomy-of-the-world.md b/book/src/explanation/anatomy-of-the-world.md index f90fc293..0695bf5a 100644 --- a/book/src/explanation/anatomy-of-the-world.md +++ b/book/src/explanation/anatomy-of-the-world.md @@ -1,5 +1,5 @@ # Anatomy of the World -Once an [`LdtkWorldBundle`](https://docs.rs/bevy_ecs_ldtk/0.8.0/bevy_ecs_ldtk/prelude/struct.LdtkWorldBundle.html) is spawned, [levels are selected](level-selection.md), and the associated assets finish loading, the level spawning process begins. +Once an [`LdtkWorldBundle`](https://docs.rs/bevy_ecs_ldtk/0.9.0/bevy_ecs_ldtk/prelude/struct.LdtkWorldBundle.html) is spawned, [levels are selected](level-selection.md), and the associated assets finish loading, the level spawning process begins. The result is a deeply nested hierarchy of entities which can be difficult to navigate, but predictable. It can be useful to write code that makes assumptions about the relationships between `bevy_ecs_ldtk` entities. To assist with this, this chapter will explain the anatomy of a `bevy_ecs_ldtk` world. @@ -8,16 +8,16 @@ To assist with this, this chapter will explain the anatomy of a `bevy_ecs_ldtk` The basic hierarchy of spawned entities and their identifying components/bundles are as follows. This does exclude some special cases which are explained in more detail below. Each bullet indent indicates a parent/child relationship. -- The world entity, with an [`LdtkWorldBundle`](https://docs.rs/bevy_ecs_ldtk/0.8.0/bevy_ecs_ldtk/prelude/struct.LdtkWorldBundle.html) bundle. - - The level entities, with a [`LevelIid`](https://docs.rs/bevy_ecs_ldtk/0.8.0/bevy_ecs_ldtk/prelude/struct.LevelIid.html) component. - - For Entity layers - a layer entity with just a [`LayerMetadata`](https://docs.rs/bevy_ecs_ldtk/0.8.0/bevy_ecs_ldtk/prelude/struct.LayerMetadata.html) component. - - LDtk Entity entities, with an [`EntityInstance`](https://docs.rs/bevy_ecs_ldtk/0.8.0/bevy_ecs_ldtk/ldtk/struct.EntityInstance.html) component, or possibly others if you're using [`LdtkEntity` registration](game-logic-integration.html#ldtkentity-and-ldtkintcell-registration). - - For Tile/AutoTile/IntGrid layers: `bevy_ecs_tilemap` tilemap entities, with a [`TilemapBundle`](https://docs.rs/bevy_ecs_tilemap/latest/bevy_ecs_tilemap/type.TilemapBundle.html) **and** a [`LayerMetadata`](https://docs.rs/bevy_ecs_ldtk/0.8.0/bevy_ecs_ldtk/prelude/struct.LayerMetadata.html) component. - - For IntGrid layers - tile entities with an [`IntGridCell`](https://docs.rs/bevy_ecs_ldtk/0.8.0/bevy_ecs_ldtk/prelude/struct.IntGridCell.html) component, or possibly others if you're using [`LdtkIntCell` registration](game-logic-integration.html#ldtkentity-and-ldtkintcell-registration). +- The world entity, with an [`LdtkWorldBundle`](https://docs.rs/bevy_ecs_ldtk/0.9.0/bevy_ecs_ldtk/prelude/struct.LdtkWorldBundle.html) bundle. + - The level entities, with a [`LevelIid`](https://docs.rs/bevy_ecs_ldtk/0.9.0/bevy_ecs_ldtk/prelude/struct.LevelIid.html) component. + - For Entity layers - a layer entity with just a [`LayerMetadata`](https://docs.rs/bevy_ecs_ldtk/0.9.0/bevy_ecs_ldtk/prelude/struct.LayerMetadata.html) component. + - LDtk Entity entities, with an [`EntityInstance`](https://docs.rs/bevy_ecs_ldtk/0.9.0/bevy_ecs_ldtk/ldtk/struct.EntityInstance.html) component, or possibly others if you're using [`LdtkEntity` registration](game-logic-integration.html#ldtkentity-and-ldtkintcell-registration). + - For Tile/AutoTile/IntGrid layers: `bevy_ecs_tilemap` tilemap entities, with a [`TilemapBundle`](https://docs.rs/bevy_ecs_tilemap/latest/bevy_ecs_tilemap/type.TilemapBundle.html) **and** a [`LayerMetadata`](https://docs.rs/bevy_ecs_ldtk/0.9.0/bevy_ecs_ldtk/prelude/struct.LayerMetadata.html) component. + - For IntGrid layers - tile entities with an [`IntGridCell`](https://docs.rs/bevy_ecs_ldtk/0.9.0/bevy_ecs_ldtk/prelude/struct.IntGridCell.html) component, or possibly others if you're using [`LdtkIntCell` registration](game-logic-integration.html#ldtkentity-and-ldtkintcell-registration). - For Tile/AutoTile layers (or IntGrid layers with AutoTile functionality) - `bevy_ecs_tilemap` tile entities, with a [`TileBundle`](https://docs.rs/bevy_ecs_tilemap/latest/bevy_ecs_tilemap/tiles/struct.TileBundle.html) bundle. ## Worldly Entities -The [`LdtkEntity` derive macro](game-logic-integration.html#ldtkentity-and-ldtkintcell-registration) allows you to define entities as ["worldly"](https://docs.rs/bevy_ecs_ldtk/0.8.0/bevy_ecs_ldtk/app/trait.LdtkEntity.html#worldly). +The [`LdtkEntity` derive macro](game-logic-integration.html#ldtkentity-and-ldtkintcell-registration) allows you to define entities as ["worldly"](https://docs.rs/bevy_ecs_ldtk/0.9.0/bevy_ecs_ldtk/app/trait.LdtkEntity.html#worldly). The intention of this feature is to support entities that are allowed to persist and traverse between levels, like a player in a GridVania layout. One consequence of an entity being worldly is a change in its placement in the above hierarchy. @@ -32,8 +32,8 @@ For example, if the worldly player entity traverses far enough away that their o LDtk allows you to associate metadata with particular tiles in a tileset. `bevy_ecs_ldtk` responds to this by adding additional components to tiles that have metadata *in addition to* those described in the [hierarchy](#hierarchy): -- [`TileMetadata`](https://docs.rs/bevy_ecs_ldtk/0.8.0/bevy_ecs_ldtk/prelude/struct.TileMetadata.html) -- [`TileEnumTags`](https://docs.rs/bevy_ecs_ldtk/0.8.0/bevy_ecs_ldtk/prelude/struct.TileEnumTags.html) +- [`TileMetadata`](https://docs.rs/bevy_ecs_ldtk/0.9.0/bevy_ecs_ldtk/prelude/struct.TileMetadata.html) +- [`TileEnumTags`](https://docs.rs/bevy_ecs_ldtk/0.9.0/bevy_ecs_ldtk/prelude/struct.TileEnumTags.html) Naturally, this can only occur in Tile/AutoTile layers (or IntGrid layers with AutoTile functionality), since the metadata is defined on tilesets. @@ -43,7 +43,7 @@ LDtk allows you to supply a background color and a background image for individu The background color is spawned as a normal bevy [`SpriteBundle`](https://docs.rs/bevy/latest/bevy/prelude/struct.SpriteBundle.html), as a child of the level entity. The background image, if it exists, is also spawned as a `SpriteBundle`. -These background sprites can be disabled (not spawned) using the settings resource [`LdtkSettings`](https://docs.rs/bevy_ecs_ldtk/0.8.0/bevy_ecs_ldtk/prelude/struct.LdtkSettings.html): +These background sprites can be disabled (not spawned) using the settings resource [`LdtkSettings`](https://docs.rs/bevy_ecs_ldtk/0.9.0/bevy_ecs_ldtk/prelude/struct.LdtkSettings.html): ```rust,no_run use bevy::prelude::*; use bevy_ecs_ldtk::prelude::*; @@ -65,7 +65,7 @@ In other words, a single layer can have more than one tile in the same location. `bevy_ecs_tilemap` tilemaps only allow one tile per position. So, `bevy_ecs_ldtk` supports layers with colliding tiles by spawning multiple tilemaps. -Each of them will have the same [`LayerMetadata`](https://docs.rs/bevy_ecs_ldtk/0.8.0/bevy_ecs_ldtk/prelude/struct.LayerMetadata.html) component. +Each of them will have the same [`LayerMetadata`](https://docs.rs/bevy_ecs_ldtk/0.9.0/bevy_ecs_ldtk/prelude/struct.LayerMetadata.html) component. This means that users cannot assume that there will be only one `LayerMetadata` entity per layer. diff --git a/book/src/explanation/game-logic-integration.md b/book/src/explanation/game-logic-integration.md index 795f6f5d..09c81c48 100644 --- a/book/src/explanation/game-logic-integration.md +++ b/book/src/explanation/game-logic-integration.md @@ -37,8 +37,8 @@ Without any intervention, the bundle's fields are constructed using the bundle's However, various attributes are available to override this behavior, like `#[sprite_bundle]` in the above example. This attribute gives the entity a sprite using the tileset in its LDtk editor visual. For documentation about all the available attributes, check out the API reference for these traits: -- [`LdtkEntity`](https://docs.rs/bevy_ecs_ldtk/0.8.0/bevy_ecs_ldtk/app/trait.LdtkEntity.html) -- [`LdtkIntCell`](https://docs.rs/bevy_ecs_ldtk/0.8.0/bevy_ecs_ldtk/app/trait.LdtkIntCell.html) +- [`LdtkEntity`](https://docs.rs/bevy_ecs_ldtk/0.9.0/bevy_ecs_ldtk/app/trait.LdtkEntity.html) +- [`LdtkIntCell`](https://docs.rs/bevy_ecs_ldtk/0.9.0/bevy_ecs_ldtk/app/trait.LdtkIntCell.html) This approach is suitable for many common, simple use cases. There's also room for more granular, component-level customization within some of the attributes, like `#[with(...)]` or `#[from_entity_instance]`. diff --git a/book/src/explanation/level-selection.md b/book/src/explanation/level-selection.md index dd411bd9..d89571bd 100644 --- a/book/src/explanation/level-selection.md +++ b/book/src/explanation/level-selection.md @@ -1,14 +1,14 @@ # Level Selection -Once you have spawned an [`LdtkWorldBundle`](https://docs.rs/bevy_ecs_ldtk/0.8.0/bevy_ecs_ldtk/prelude/struct.LdtkWorldBundle.html) with a handle pointing to your LDtk project file, the levels you have selected will spawn as children of the world bundle. +Once you have spawned an [`LdtkWorldBundle`](https://docs.rs/bevy_ecs_ldtk/0.9.0/bevy_ecs_ldtk/prelude/struct.LdtkWorldBundle.html) with a handle pointing to your LDtk project file, the levels you have selected will spawn as children of the world bundle. You have a couple options for selecting levels, which will be discussed in this chapter. ## `LevelSelection` resource -The highest-level option for selecting a level to spawn is using the [`LevelSelection`](https://docs.rs/bevy_ecs_ldtk/0.8.0/bevy_ecs_ldtk/prelude/enum.LevelSelection.html) resource. +The highest-level option for selecting a level to spawn is using the [`LevelSelection`](https://docs.rs/bevy_ecs_ldtk/0.9.0/bevy_ecs_ldtk/prelude/enum.LevelSelection.html) resource. This resource allows you to specify a particular level either by its indices in the project/world, its identifier, its iid, or its uid. Once this resource is added or changed, levels will be spawned/despawned in order to match your selection. One additional feature worth pointing out is loading level neighbors. -You can enable this with the settings resource [`LdtkSettings`](https://docs.rs/bevy_ecs_ldtk/0.8.0/bevy_ecs_ldtk/prelude/struct.LdtkSettings.html): +You can enable this with the settings resource [`LdtkSettings`](https://docs.rs/bevy_ecs_ldtk/0.9.0/bevy_ecs_ldtk/prelude/struct.LdtkSettings.html): ```rust,no_run use bevy::prelude::*; @@ -33,7 +33,7 @@ This can be especially useful for GridVania/Free-style worlds where it's importa Note: this *only* works if you are using the `LevelSelection` resource. ## `LevelSet` component -One component in the `LdtkWorldBundle` is [`LevelSet`](https://docs.rs/bevy_ecs_ldtk/0.8.0/bevy_ecs_ldtk/prelude/struct.LevelSet.html). +One component in the `LdtkWorldBundle` is [`LevelSet`](https://docs.rs/bevy_ecs_ldtk/0.9.0/bevy_ecs_ldtk/prelude/struct.LevelSet.html). This component can be used for lower-level level selection. Instead of selecting one level globally with a `LevelSelection` resource, you can select a specific set of levels by their iids. From the `level_set` cargo example: diff --git a/book/src/how-to-guides/respawn-levels-and-worlds.md b/book/src/how-to-guides/respawn-levels-and-worlds.md index 71091ad1..24b0987c 100644 --- a/book/src/how-to-guides/respawn-levels-and-worlds.md +++ b/book/src/how-to-guides/respawn-levels-and-worlds.md @@ -1,5 +1,5 @@ # Respawn Levels and Worlds -Internally, `bevy_ecs_ldtk` uses a [`Respawn`](https://docs.rs/bevy_ecs_ldtk/0.8.0/bevy_ecs_ldtk/prelude/struct.Respawn.html) component on worlds and levels to assist in the spawning process. +Internally, `bevy_ecs_ldtk` uses a [`Respawn`](https://docs.rs/bevy_ecs_ldtk/0.9.0/bevy_ecs_ldtk/prelude/struct.Respawn.html) component on worlds and levels to assist in the spawning process. This can be leveraged by users to implement a simple level restart feature, or an even more heavy-handed world restart feature. This code is from the `collectathon` cargo example. diff --git a/macros/Cargo.toml b/macros/Cargo.toml index 3dd1a7fa..2025944b 100644 --- a/macros/Cargo.toml +++ b/macros/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bevy_ecs_ldtk_macros" description = "Derive macros for bevy_ecs_ldtk." -version = "0.8.0" +version = "0.9.0" edition = "2021" authors = ["Trevor Lovell "] license = "MIT OR Apache-2.0" diff --git a/src/app/ldtk_entity.rs b/src/app/ldtk_entity.rs index 3b266bbf..0e5d84cc 100644 --- a/src/app/ldtk_entity.rs +++ b/src/app/ldtk_entity.rs @@ -139,7 +139,7 @@ use std::{collections::HashMap, marker::PhantomData}; /// [Worldly] entities don't despawn when their birth level despawns, and they don't respawn when /// their birth level respawns. /// For a more detailed explanation, please see the -/// [*Worldly Entities*](https://trouv.github.io/bevy_ecs_ldtk/v0.8.0/explanation/anatomy-of-the-world.html#worldly-entities) +/// [*Worldly Entities*](https://trouv.github.io/bevy_ecs_ldtk/v0.9.0/explanation/anatomy-of-the-world.html#worldly-entities) /// section of the `bevy_ecs_ldtk` book. /// ``` /// # use bevy::prelude::*; diff --git a/src/components/level_set.rs b/src/components/level_set.rs index 7bb13ece..c8927d3d 100644 --- a/src/components/level_set.rs +++ b/src/components/level_set.rs @@ -6,7 +6,7 @@ use crate::LevelIid; /// [`Component`] that determines the desired levels to be spawned in an [`LdtkWorldBundle`]. /// /// For more explanation and comparison of options for selecting levels to spawn, see the -/// [*Level Selection*](https://trouv.github.io/bevy_ecs_ldtk/v0.8.0/explanation/level-selection.html) +/// [*Level Selection*](https://trouv.github.io/bevy_ecs_ldtk/v0.9.0/explanation/level-selection.html) /// chapter of the `bevy_ecs_ldtk` book. /// /// [`Component`]: https://docs.rs/bevy/latest/bevy/ecs/prelude/trait.Component.html diff --git a/src/components/mod.rs b/src/components/mod.rs index 68359a36..51b2d98f 100644 --- a/src/components/mod.rs +++ b/src/components/mod.rs @@ -40,7 +40,7 @@ pub struct IntGridCell { /// [`Component`] that indicates that an ldtk entity should be a child of the world, not their layer. /// /// For a more detailed explanation, please see the -/// [*Worldly Entities*](https://trouv.github.io/bevy_ecs_ldtk/v0.8.0/explanation/anatomy-of-the-world.html#worldly-entities) +/// [*Worldly Entities*](https://trouv.github.io/bevy_ecs_ldtk/v0.9.0/explanation/anatomy-of-the-world.html#worldly-entities) /// section of the `bevy_ecs_ldtk` book. /// /// Implements [`LdtkEntity`], and can be added to an [`LdtkEntity`] bundle with the `#[worldly]` @@ -302,7 +302,7 @@ impl From<&LayerInstance> for LayerMetadata { /// [Component] that indicates that an LDtk level or world should respawn. /// /// For more details and example usage, please see the -/// [*Respawn Levels and Worlds*](https://trouv.github.io/bevy_ecs_ldtk/v0.8.0/how-to-guides/respawn-levels-and-worlds.html) +/// [*Respawn Levels and Worlds*](https://trouv.github.io/bevy_ecs_ldtk/v0.9.0/how-to-guides/respawn-levels-and-worlds.html) /// chapter of the `bevy_ecs_ldtk` book. #[derive(Copy, Clone, Eq, PartialEq, Debug, Default, Hash, Component, Reflect)] #[reflect(Component)] @@ -327,7 +327,7 @@ pub(crate) struct EntityInstanceBundle { /// `Bundle` for spawning LDtk worlds and their levels. The main bundle for using this plugin. /// /// For a more detailed explanation of the resulting world, please see the -/// [*Anatomy of the World*](https://trouv.github.io/bevy_ecs_ldtk/v0.8.0/explanation/anatomy-of-the-world.html) +/// [*Anatomy of the World*](https://trouv.github.io/bevy_ecs_ldtk/v0.9.0/explanation/anatomy-of-the-world.html) /// chapter of the `bevy_ecs_ldtk` book. #[derive(Clone, Default, Bundle)] pub struct LdtkWorldBundle { diff --git a/src/lib.rs b/src/lib.rs index ebf2f5b5..53742eb4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,15 +4,15 @@ //! ## This API Reference //! The purpose of this API reference is to describe the API provided by this plugin. //! More explanation-oriented documentation, tutorials, and guides are available in the -//! [`bevy_ecs_ldtk` book](https://trouv.github.io/bevy_ecs_ldtk/v0.8.0). +//! [`bevy_ecs_ldtk` book](https://trouv.github.io/bevy_ecs_ldtk/v0.9.0). //! //! The following chapters are good jumping-off points for beginners: -//! - [*Tile-based Game* tutorial](https://trouv.github.io/bevy_ecs_ldtk/v0.8.0/tutorials/tile-based-game/index.html) -//! - [*Level Selection* explanation](https://trouv.github.io/bevy_ecs_ldtk/v0.8.0/explanation/level-selection.html) -//! - [*Game Logic Integration* explanation](https://trouv.github.io/bevy_ecs_ldtk/v0.8.0/explanation/game-logic-integration.html) +//! - [*Tile-based Game* tutorial](https://trouv.github.io/bevy_ecs_ldtk/v0.9.0/tutorials/tile-based-game/index.html) +//! - [*Level Selection* explanation](https://trouv.github.io/bevy_ecs_ldtk/v0.9.0/explanation/level-selection.html) +//! - [*Game Logic Integration* explanation](https://trouv.github.io/bevy_ecs_ldtk/v0.9.0/explanation/game-logic-integration.html) //! //! Cargo examples are also available in this plugin's -//! [github repository](https://github.com/Trouv/bevy_ecs_ldtk/tree/v0.8.0/examples). +//! [github repository](https://github.com/Trouv/bevy_ecs_ldtk/tree/v0.9.0/examples). //! //! ## Feature flags //! diff --git a/src/resources/level_selection.rs b/src/resources/level_selection.rs index f7a37381..d628b8d1 100644 --- a/src/resources/level_selection.rs +++ b/src/resources/level_selection.rs @@ -4,7 +4,7 @@ use bevy::prelude::*; /// [`Resource`] for choosing which level(s) to spawn. /// /// For more explanation and comparison of options for selecting levels to spawn, see the -/// [*Level Selection*](https://trouv.github.io/bevy_ecs_ldtk/v0.8.0/explanation/level-selection.html) +/// [*Level Selection*](https://trouv.github.io/bevy_ecs_ldtk/v0.9.0/explanation/level-selection.html) /// chapter of the `bevy_ecs_ldtk` book. /// /// [`Resource`]: https://docs.rs/bevy/latest/bevy/ecs/prelude/trait.Resource.html