Skip to content

Commit

Permalink
deploy: b09d10b
Browse files Browse the repository at this point in the history
  • Loading branch information
Trouv committed Dec 23, 2024
1 parent 6cff0d8 commit e0e9d2e
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 40 deletions.
24 changes: 12 additions & 12 deletions main/explanation/anatomy-of-the-world.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ <h1 class="menu-title">bevy_ecs_ldtk Book</h1>
<div id="content" class="content">
<main>
<h1 id="anatomy-of-the-world"><a class="header" href="#anatomy-of-the-world">Anatomy of the World</a></h1>
<p>Once an <a href="https://docs.rs/bevy_ecs_ldtk/0.10.0/bevy_ecs_ldtk/prelude/struct.LdtkWorldBundle.html"><code>LdtkWorldBundle</code></a> is spawned, <a href="level-selection.html">levels are selected</a>, and the associated assets finish loading, the level spawning process begins. <!-- x-release-please-version -->
<p>Once an <a href="https://docs.rs/bevy_ecs_ldtk/0.11.0/bevy_ecs_ldtk/prelude/struct.LdtkWorldBundle.html"><code>LdtkWorldBundle</code></a> is spawned, <a href="level-selection.html">levels are selected</a>, and the associated assets finish loading, the level spawning process begins. <!-- x-release-please-version -->
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 <code>bevy_ecs_ldtk</code> entities.
To assist with this, this chapter will explain the anatomy of a <code>bevy_ecs_ldtk</code> world.</p>
Expand All @@ -181,18 +181,18 @@ <h2 id="hierarchy"><a class="header" href="#hierarchy">Hierarchy</a></h2>
This does exclude some special cases which are explained in more detail below.
Each bullet indent indicates a parent/child relationship.</p>
<ul>
<li>The world entity, with an <a href="https://docs.rs/bevy_ecs_ldtk/0.10.0/bevy_ecs_ldtk/prelude/struct.LdtkWorldBundle.html"><code>LdtkWorldBundle</code></a> bundle. <!-- x-release-please-version -->
<li>The world entity, with an <a href="https://docs.rs/bevy_ecs_ldtk/0.11.0/bevy_ecs_ldtk/prelude/struct.LdtkWorldBundle.html"><code>LdtkWorldBundle</code></a> bundle. <!-- x-release-please-version -->
<ul>
<li>The level entities, with a <a href="https://docs.rs/bevy_ecs_ldtk/0.10.0/bevy_ecs_ldtk/prelude/struct.LevelIid.html"><code>LevelIid</code></a> component. <!-- x-release-please-version -->
<li>The level entities, with a <a href="https://docs.rs/bevy_ecs_ldtk/0.11.0/bevy_ecs_ldtk/prelude/struct.LevelIid.html"><code>LevelIid</code></a> component. <!-- x-release-please-version -->
<ul>
<li>For Entity layers - a layer entity with just a <a href="https://docs.rs/bevy_ecs_ldtk/0.10.0/bevy_ecs_ldtk/prelude/struct.LayerMetadata.html"><code>LayerMetadata</code></a> component. <!-- x-release-please-version -->
<li>For Entity layers - a layer entity with just a <a href="https://docs.rs/bevy_ecs_ldtk/0.11.0/bevy_ecs_ldtk/prelude/struct.LayerMetadata.html"><code>LayerMetadata</code></a> component. <!-- x-release-please-version -->
<ul>
<li>LDtk Entity entities, with an <a href="https://docs.rs/bevy_ecs_ldtk/0.10.0/bevy_ecs_ldtk/ldtk/struct.EntityInstance.html"><code>EntityInstance</code></a> component, or possibly others if you're using <a href="game-logic-integration.html#ldtkentity-and-ldtkintcell-registration"><code>LdtkEntity</code> registration</a>. <!-- x-release-please-version --> </li>
<li>LDtk Entity entities, with an <a href="https://docs.rs/bevy_ecs_ldtk/0.11.0/bevy_ecs_ldtk/ldtk/struct.EntityInstance.html"><code>EntityInstance</code></a> component, or possibly others if you're using <a href="game-logic-integration.html#ldtkentity-and-ldtkintcell-registration"><code>LdtkEntity</code> registration</a>. <!-- x-release-please-version --> </li>
</ul>
</li>
<li>For Tile/AutoTile/IntGrid layers: <code>bevy_ecs_tilemap</code> tilemap entities, with a <a href="https://docs.rs/bevy_ecs_tilemap/latest/bevy_ecs_tilemap/type.TilemapBundle.html"><code>TilemapBundle</code></a> <strong>and</strong> a <a href="https://docs.rs/bevy_ecs_ldtk/0.10.0/bevy_ecs_ldtk/prelude/struct.LayerMetadata.html"><code>LayerMetadata</code></a> component. <!-- x-release-please-version -->
<li>For Tile/AutoTile/IntGrid layers: <code>bevy_ecs_tilemap</code> tilemap entities, with a <a href="https://docs.rs/bevy_ecs_tilemap/latest/bevy_ecs_tilemap/type.TilemapBundle.html"><code>TilemapBundle</code></a> <strong>and</strong> a <a href="https://docs.rs/bevy_ecs_ldtk/0.11.0/bevy_ecs_ldtk/prelude/struct.LayerMetadata.html"><code>LayerMetadata</code></a> component. <!-- x-release-please-version -->
<ul>
<li>For IntGrid layers - tile entities with an <a href="https://docs.rs/bevy_ecs_ldtk/0.10.0/bevy_ecs_ldtk/prelude/struct.IntGridCell.html"><code>IntGridCell</code></a> component, or possibly others if you're using <a href="game-logic-integration.html#ldtkentity-and-ldtkintcell-registration"><code>LdtkIntCell</code> registration</a>. <!-- x-release-please-version --></li>
<li>For IntGrid layers - tile entities with an <a href="https://docs.rs/bevy_ecs_ldtk/0.11.0/bevy_ecs_ldtk/prelude/struct.IntGridCell.html"><code>IntGridCell</code></a> component, or possibly others if you're using <a href="game-logic-integration.html#ldtkentity-and-ldtkintcell-registration"><code>LdtkIntCell</code> registration</a>. <!-- x-release-please-version --></li>
<li>For Tile/AutoTile layers (or IntGrid layers with AutoTile functionality) - <code>bevy_ecs_tilemap</code> tile entities, with a <a href="https://docs.rs/bevy_ecs_tilemap/latest/bevy_ecs_tilemap/tiles/struct.TileBundle.html"><code>TileBundle</code></a> bundle.</li>
</ul>
</li>
Expand All @@ -202,7 +202,7 @@ <h2 id="hierarchy"><a class="header" href="#hierarchy">Hierarchy</a></h2>
</li>
</ul>
<h2 id="worldly-entities"><a class="header" href="#worldly-entities">Worldly Entities</a></h2>
<p>The <a href="game-logic-integration.html#ldtkentity-and-ldtkintcell-registration"><code>LdtkEntity</code> derive macro</a> allows you to define entities as <a href="https://docs.rs/bevy_ecs_ldtk/0.10.0/bevy_ecs_ldtk/app/trait.LdtkEntity.html#worldly">&quot;worldly&quot;</a>. <!-- x-release-please-version -->
<p>The <a href="game-logic-integration.html#ldtkentity-and-ldtkintcell-registration"><code>LdtkEntity</code> derive macro</a> allows you to define entities as <a href="https://docs.rs/bevy_ecs_ldtk/0.11.0/bevy_ecs_ldtk/app/trait.LdtkEntity.html#worldly">&quot;worldly&quot;</a>. <!-- x-release-please-version -->
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.</p>
<p>One consequence of an entity being worldly is a change in its placement in the above hierarchy.
Instead of being spawned as a child of the Entity layer entity, worldly entities will be children of the world entity (after one update).
Expand All @@ -214,16 +214,16 @@ <h2 id="tile-metadata-components"><a class="header" href="#tile-metadata-compone
<p>LDtk allows you to associate metadata with particular tiles in a tileset.
<code>bevy_ecs_ldtk</code> responds to this by adding additional components to tiles that have metadata <em>in addition to</em> those described in the <a href="#hierarchy">hierarchy</a>:</p>
<ul>
<li><a href="https://docs.rs/bevy_ecs_ldtk/0.10.0/bevy_ecs_ldtk/prelude/struct.TileMetadata.html"><code>TileMetadata</code></a> <!-- x-release-please-version --></li>
<li><a href="https://docs.rs/bevy_ecs_ldtk/0.10.0/bevy_ecs_ldtk/prelude/struct.TileEnumTags.html"><code>TileEnumTags</code></a> <!-- x-release-please-version --></li>
<li><a href="https://docs.rs/bevy_ecs_ldtk/0.11.0/bevy_ecs_ldtk/prelude/struct.TileMetadata.html"><code>TileMetadata</code></a> <!-- x-release-please-version --></li>
<li><a href="https://docs.rs/bevy_ecs_ldtk/0.11.0/bevy_ecs_ldtk/prelude/struct.TileEnumTags.html"><code>TileEnumTags</code></a> <!-- x-release-please-version --></li>
</ul>
<p>Naturally, this can only occur in Tile/AutoTile layers (or IntGrid layers with AutoTile functionality), since the metadata is defined on tilesets.</p>
<h2 id="level-backgrounds"><a class="header" href="#level-backgrounds">Level backgrounds</a></h2>
<p>LDtk allows you to supply a background color and a background image for individual levels.
<code>bevy_ecs_ldtk</code> renders these by default.
The background color is spawned as a normal bevy <a href="https://docs.rs/bevy/latest/bevy/prelude/struct.Sprite.html"><code>Sprite</code></a>, as a child of the level entity.
The background image, if it exists, is also spawned as a <code>Sprite</code>.</p>
<p>These background sprites can be disabled (not spawned) using the settings resource <a href="https://docs.rs/bevy_ecs_ldtk/0.10.0/bevy_ecs_ldtk/prelude/struct.LdtkSettings.html"><code>LdtkSettings</code></a>: <!-- x-release-please-version --></p>
<p>These background sprites can be disabled (not spawned) using the settings resource <a href="https://docs.rs/bevy_ecs_ldtk/0.11.0/bevy_ecs_ldtk/prelude/struct.LdtkSettings.html"><code>LdtkSettings</code></a>: <!-- x-release-please-version --></p>
<pre><pre class="playground"><code class="language-rust no_run">use bevy::prelude::*;
use bevy_ecs_ldtk::prelude::*;

Expand All @@ -241,7 +241,7 @@ <h2 id="layers-with-colliding-tiles"><a class="header" href="#layers-with-collid
In other words, a single layer can have more than one tile in the same location.</p>
<p><code>bevy_ecs_tilemap</code> tilemaps only allow one tile per position.
So, <code>bevy_ecs_ldtk</code> supports layers with colliding tiles by spawning multiple tilemaps.
Each of them will have the same <a href="https://docs.rs/bevy_ecs_ldtk/0.10.0/bevy_ecs_ldtk/prelude/struct.LayerMetadata.html"><code>LayerMetadata</code></a> component. <!-- x-release-please-version -->
Each of them will have the same <a href="https://docs.rs/bevy_ecs_ldtk/0.11.0/bevy_ecs_ldtk/prelude/struct.LayerMetadata.html"><code>LayerMetadata</code></a> component. <!-- x-release-please-version -->
This means that users cannot assume that there will be only one <code>LayerMetadata</code> entity per layer.</p>
<h2 id="z-order"><a class="header" href="#z-order">Z order</a></h2>
<p>To correctly define the render order of the tiles and entities in a level, <code>bevy_ecs_ldtk</code> uses the <code>z</code> value of their <code>Transform</code> components.
Expand Down
4 changes: 2 additions & 2 deletions main/explanation/game-logic-integration.html
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,8 @@ <h2 id="ldtkentity-and-ldtkintcell-registration"><a class="header" href="#ldtken
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:</p>
<ul>
<li><a href="https://docs.rs/bevy_ecs_ldtk/0.10.0/bevy_ecs_ldtk/app/trait.LdtkEntity.html"><code>LdtkEntity</code></a> <!-- x-release-please-version --></li>
<li><a href="https://docs.rs/bevy_ecs_ldtk/0.10.0/bevy_ecs_ldtk/app/trait.LdtkIntCell.html"><code>LdtkIntCell</code></a> <!-- x-release-please-version --></li>
<li><a href="https://docs.rs/bevy_ecs_ldtk/0.11.0/bevy_ecs_ldtk/app/trait.LdtkEntity.html"><code>LdtkEntity</code></a> <!-- x-release-please-version --></li>
<li><a href="https://docs.rs/bevy_ecs_ldtk/0.11.0/bevy_ecs_ldtk/app/trait.LdtkIntCell.html"><code>LdtkIntCell</code></a> <!-- x-release-please-version --></li>
</ul>
<p>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 <code>#[with(...)]</code> or <code>#[from_entity_instance]</code>.
Expand Down
8 changes: 4 additions & 4 deletions main/explanation/level-selection.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,14 @@ <h1 class="menu-title">bevy_ecs_ldtk Book</h1>
<div id="content" class="content">
<main>
<h1 id="level-selection"><a class="header" href="#level-selection">Level Selection</a></h1>
<p>Once you have spawned an <a href="https://docs.rs/bevy_ecs_ldtk/0.10.0/bevy_ecs_ldtk/prelude/struct.LdtkWorldBundle.html"><code>LdtkWorldBundle</code></a> with a handle pointing to your LDtk project file, the levels you have selected will spawn as children of the world bundle. <!-- x-release-please-version -->
<p>Once you have spawned an <a href="https://docs.rs/bevy_ecs_ldtk/0.11.0/bevy_ecs_ldtk/prelude/struct.LdtkWorldBundle.html"><code>LdtkWorldBundle</code></a> with a handle pointing to your LDtk project file, the levels you have selected will spawn as children of the world bundle. <!-- x-release-please-version -->
You have a couple options for selecting levels, which will be discussed in this chapter.</p>
<h2 id="levelselection-resource"><a class="header" href="#levelselection-resource"><code>LevelSelection</code> resource</a></h2>
<p>The highest-level option for selecting a level to spawn is using the <a href="https://docs.rs/bevy_ecs_ldtk/0.10.0/bevy_ecs_ldtk/prelude/enum.LevelSelection.html"><code>LevelSelection</code></a> resource. <!-- x-release-please-version -->
<p>The highest-level option for selecting a level to spawn is using the <a href="https://docs.rs/bevy_ecs_ldtk/0.11.0/bevy_ecs_ldtk/prelude/enum.LevelSelection.html"><code>LevelSelection</code></a> resource. <!-- x-release-please-version -->
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.</p>
<p>One additional feature worth pointing out is loading level neighbors.
You can enable this with the settings resource <a href="https://docs.rs/bevy_ecs_ldtk/0.10.0/bevy_ecs_ldtk/prelude/struct.LdtkSettings.html"><code>LdtkSettings</code></a>: <!-- x-release-please-version --></p>
You can enable this with the settings resource <a href="https://docs.rs/bevy_ecs_ldtk/0.11.0/bevy_ecs_ldtk/prelude/struct.LdtkSettings.html"><code>LdtkSettings</code></a>: <!-- x-release-please-version --></p>
<pre><pre class="playground"><code class="language-rust no_run">use bevy::prelude::*;
use bevy_ecs_ldtk::prelude::*;

Expand All @@ -199,7 +199,7 @@ <h2 id="levelselection-resource"><a class="header" href="#levelselection-resourc
This can be especially useful for GridVania/Free-style worlds where it's important to have a level spawned before the player traverses to it.
Note: this <em>only</em> works if you are using the <code>LevelSelection</code> resource.</p>
<h2 id="levelset-component"><a class="header" href="#levelset-component"><code>LevelSet</code> component</a></h2>
<p>One component in the <code>LdtkWorldBundle</code> is <a href="https://docs.rs/bevy_ecs_ldtk/0.10.0/bevy_ecs_ldtk/prelude/struct.LevelSet.html"><code>LevelSet</code></a>. <!-- x-release-please-version -->
<p>One component in the <code>LdtkWorldBundle</code> is <a href="https://docs.rs/bevy_ecs_ldtk/0.11.0/bevy_ecs_ldtk/prelude/struct.LevelSet.html"><code>LevelSet</code></a>. <!-- x-release-please-version -->
This component can be used for lower-level level selection.
Instead of selecting one level globally with a <code>LevelSelection</code> resource, you can select a specific set of levels by their iids.
From the <code>level_set</code> cargo example:</p>
Expand Down
2 changes: 1 addition & 1 deletion main/how-to-guides/respawn-levels-and-worlds.html
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ <h1 class="menu-title">bevy_ecs_ldtk Book</h1>
<div id="content" class="content">
<main>
<h1 id="respawn-levels-and-worlds"><a class="header" href="#respawn-levels-and-worlds">Respawn Levels and Worlds</a></h1>
<p>Internally, <code>bevy_ecs_ldtk</code> uses a <a href="https://docs.rs/bevy_ecs_ldtk/0.10.0/bevy_ecs_ldtk/prelude/struct.Respawn.html"><code>Respawn</code></a> component on worlds and levels to assist in the spawning process. <!-- x-release-please-version -->
<p>Internally, <code>bevy_ecs_ldtk</code> uses a <a href="https://docs.rs/bevy_ecs_ldtk/0.11.0/bevy_ecs_ldtk/prelude/struct.Respawn.html"><code>Respawn</code></a> component on worlds and levels to assist in the spawning process. <!-- x-release-please-version -->
This can be leveraged by users to implement a simple level restart feature, or an even more heavy-handed world restart feature.</p>
<p>This code is from the <code>collectathon</code> cargo example.</p>
<h2 id="respawn-the-world"><a class="header" href="#respawn-the-world">Respawn the world</a></h2>
Expand Down
2 changes: 1 addition & 1 deletion main/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ <h2 id="other-resources"><a class="header" href="#other-resources">Other resourc
Some resources for learning Bevy include those listed on the <a href="https://bevyengine.org/learn">Bevy website</a>, as well as the unofficial <a href="https://bevy-cheatbook.github.io/">Bevy Cheat Book</a>.
LDtk also provides documentation on <a href="https://ldtk.io/docs/">its website</a>.</p>
<p><code>bevy_ecs_ldtk</code>'s <a href="https://github.com/Trouv/bevy_ecs_ldtk">source code</a> is available on github.
This repository also contains <a href="https://github.com/Trouv/bevy_ecs_ldtk/tree/v0.10.0/examples">cargo examples</a>, which can be run after cloning the repository using <code>$ cargo run --example example-name</code>. <!-- x-release-please-version -->
This repository also contains <a href="https://github.com/Trouv/bevy_ecs_ldtk/tree/v0.11.0/examples">cargo examples</a>, which can be run after cloning the repository using <code>$ cargo run --example example-name</code>. <!-- x-release-please-version -->
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 <code>main</code> branch that are not released yet, and trying to apply these to the version of the plugin you are using can lead to errors.</p>
Expand Down
Loading

0 comments on commit e0e9d2e

Please sign in to comment.