You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat!: upgrade to bevy and bevy_ecs_tilemap 0.15 (#340)
To keep up with the bevy ecosystem, this change makes bevy_ecs_ldtk compatible with bevy 0.15. Aside from the dependency breaking changes, this also introduces some breaking changes to bevy_ecs_ldtk itself, which are covered in the new migration guide in the book.
---------
Co-authored-by: Matthias Schiffer <mschiffer@universe-factory.net>
Co-authored-by: Trevor Lovell <trevorlovelldesign@gmail.com>
Copy file name to clipboardexpand all lines: book/src/explanation/anatomy-of-the-world.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -40,8 +40,8 @@ Naturally, this can only occur in Tile/AutoTile layers (or IntGrid layers with A
40
40
## Level backgrounds
41
41
LDtk allows you to supply a background color and a background image for individual levels.
42
42
`bevy_ecs_ldtk` renders these by default.
43
-
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.
44
-
The background image, if it exists, is also spawned as a `SpriteBundle`.
43
+
The background color is spawned as a normal bevy [`Sprite`](https://docs.rs/bevy/latest/bevy/prelude/struct.Sprite.html), as a child of the level entity.
44
+
The background image, if it exists, is also spawned as a `Sprite`.
45
45
46
46
These background sprites can be disabled (not spawned) using the settings resource [`LdtkSettings`](https://docs.rs/bevy_ecs_ldtk/0.10.0/bevy_ecs_ldtk/prelude/struct.LdtkSettings.html): <!-- x-release-please-version -->
`bevy_ecs_ldtk` has upgraded to Bevy and `bevy_ecs_tilemap` version `0.15`.
5
+
A Bevy `0.15` migration guide is available on [Bevy's website](https://bevyengine.org/learn/migration-guides/0-14-to-0-15/).
6
+
7
+
## `LdtkSpriteSheetBundle` replaced with `Sprite`
8
+
Since the `Sprite` struct in Bevy `0.15` can now store `TextureAtlas` information on its own, the use of `LdtkSpriteSheetBundle` has been replaced by a simple use of `Sprite`. The macro has changed as well, and is now named `#[sprite_sheet]`.
9
+
```rust,ignore
10
+
// 0.10
11
+
# use bevy_ecs_ldtk::prelude::*;
12
+
# use bevy::prelude::*;
13
+
#[derive(Default, Bundle, LdtkEntity)]
14
+
struct PlayerBundle {
15
+
#[sprite_sheet_bundle]
16
+
sprite_bundle: LdtkSpriteSheetBundle,
17
+
#[grid_coords]
18
+
grid_coords: GridCoords,
19
+
}
20
+
```
21
+
```rust,ignore
22
+
// 0.11
23
+
# use bevy_ecs_ldtk::prelude::*;
24
+
# use bevy::prelude::*;
25
+
#[derive(Default, Bundle, LdtkEntity)]
26
+
struct PlayerBundle {
27
+
#[sprite_sheet]
28
+
sprite_sheet: Sprite,
29
+
#[grid_coords]
30
+
grid_coords: GridCoords,
31
+
}
32
+
```
33
+
34
+
## `SpriteBundle` also replaced with `Sprite`
35
+
When using a `SpriteBundle` with the `#[sprite_bundle]` macro, use a `Sprite` instead. The macro is now named `#[sprite]`.
36
+
```rust,ignore
37
+
// 0.10
38
+
# use bevy_ecs_ldtk::prelude::*;
39
+
# use bevy::prelude::*;
40
+
#[derive(Bundle, LdtkEntity, Default)]
41
+
pub struct Player {
42
+
player: PlayerComponent,
43
+
health: Health,
44
+
#[sprite_bundle]
45
+
sprite_bundle: SpriteBundle,
46
+
}
47
+
```
48
+
```rust,ignore
49
+
// 0.11
50
+
# use bevy_ecs_ldtk::prelude::*;
51
+
# use bevy::prelude::*;
52
+
#[derive(Bundle, LdtkEntity, Default)]
53
+
pub struct Player {
54
+
player: PlayerComponent,
55
+
health: Health,
56
+
#[sprite]
57
+
sprite: Sprite,
58
+
}
59
+
```
60
+
61
+
## `Handle<LdtkProject>` replaced with `LdtkProjectHandle`
62
+
Handles cannot be used as components in Bevy `0.15` onward. This has two changes.
63
+
### Call `.into()` when loading a project
64
+
First, you must call `.into()` when loading the world.
Second, uses of `Handle<LdtkProject>` in queries must be replaced with `LdtkProjectHandle`. It is enough to replace the type in the signature, as the `LdtkProjectHandle` type is a drop-in replacement for the handle.
Copy file name to clipboardexpand all lines: book/src/how-to-guides/migration-guides/migrate-from-0.8-to-0.9.md
+14-14
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ To update your game to LDtk 1.5.3, you should only need to install the new versi
12
12
Fields on an `LdtkEntity`- or `LdtkIntCell`-derived bundle are no longer constructed from the field's `Default` implementation, but the bundle's.
13
13
14
14
You may observe different behavior in `0.9` if the value for a field in your bundle's `Default` implementation differs from the field type's own `Default` implementation:
0 commit comments