Trouv / bevy_ecs_ldtk

ECS-friendly ldtk plugin for bevy, leveraging bevy_ecs_tilemap
Other
664 stars 75 forks source link

Can't compile the platformer example #166

Closed miyoku157 closed 1 year ago

miyoku157 commented 1 year ago

I tried to move the platformer example in a standalone crate project in order to make test on it . But Every time i try to compile it i have some Error:

error: proc-macro derive panicked
   --> src/components.rs:243:34
    |
243 | #[derive(Clone, Default, Bundle, LdtkEntity)]
    |                                  ^^^^^^^^^^
    |
    = help: message: #[sprite_sheet_bundle...] attribute should take the form #[sprite_sheet_bundle("asset/path.png", tile_width, tile_height, columns, rows, padding, offset, index)] or #[sprite_sheet_bundle]

error[E0277]: the trait bound `ColliderBundle: From<bevy_ecs_ldtk::EntityInstance>` is not satisfied
   --> src/components.rs:117:34
    |
117 | #[derive(Clone, Default, Bundle, LdtkEntity)]
    |                                  ^^^^^^^^^^ the trait `From<bevy_ecs_ldtk::EntityInstance>` is not implemented for `ColliderBundle`
    |
    = help: the trait `From<&bevy_ecs_ldtk::EntityInstance>` is implemented for `ColliderBundle`
    = note: this error originates in the derive macro `LdtkEntity` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `components::Items: From<bevy_ecs_ldtk::EntityInstance>` is not satisfied
   --> src/components.rs:117:34
    |
117 | #[derive(Clone, Default, Bundle, LdtkEntity)]
    |                                  ^^^^^^^^^^ the trait `From<bevy_ecs_ldtk::EntityInstance>` is not implemented for `components::Items`
    |
    = help: the trait `From<&bevy_ecs_ldtk::EntityInstance>` is implemented for `components::Items`
    = note: this error originates in the derive macro `LdtkEntity` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `ColliderBundle: From<bevy_ecs_ldtk::EntityInstance>` is not satisfied
   --> src/components.rs:220:34
    |
220 | #[derive(Clone, Default, Bundle, LdtkEntity)]
    |                                  ^^^^^^^^^^ the trait `From<bevy_ecs_ldtk::EntityInstance>` is not implemented for `ColliderBundle`
    |
    = help: the trait `From<&bevy_ecs_ldtk::EntityInstance>` is implemented for `ColliderBundle`
    = note: this error originates in the derive macro `LdtkEntity` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `ColliderBundle: From<bevy_ecs_ldtk::EntityInstance>` is not satisfied
   --> src/components.rs:233:34
    |
233 | #[derive(Clone, Default, Bundle, LdtkEntity)]
    |                                  ^^^^^^^^^^ the trait `From<bevy_ecs_ldtk::EntityInstance>` is not implemented for `ColliderBundle`
    |
    = help: the trait `From<&bevy_ecs_ldtk::EntityInstance>` is implemented for `ColliderBundle`
    = note: this error originates in the derive macro `LdtkEntity` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `PumpkinsBundle: bevy_ecs_ldtk::app::LdtkEntity` is not satisfied
  --> src/main.rs:48:33
   |
48 |         .register_ldtk_entity::<components::PumpkinsBundle>("Pumpkins")
   |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `bevy_ecs_ldtk::app::LdtkEntity` is not implemented for `PumpkinsBundle`
   |
   = help: the following other types implement trait `bevy_ecs_ldtk::app::LdtkEntity`:
             ChestBundle
             MobBundle
             PlayerBundle
             bevy::prelude::SpriteBundle
             bevy::prelude::SpriteSheetBundle
             bevy_ecs_ldtk::GridCoords
             bevy_ecs_ldtk::Worldly
             components::Patrol
note: required by a bound in `register_ldtk_entity`
  --> /home/miyoarch/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_ecs_ldtk-0.5.0/src/app/register_ldtk_objects.rs:77:32
   |
77 |     fn register_ldtk_entity<B: LdtkEntity + Bundle>(
   |                                ^^^^^^^^^^ required by this bound in `register_ldtk_entity`

Maybe i did something wrong with my Cargo.toml file? I can't figure it out?

[package]
name = "ldtk_test"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bevy = { version = "0.9.1", default-features = false, features = [
    "bevy_winit",
    "bevy_core_pipeline",
    "bevy_render",
    "bevy_asset",
    "wayland",
    "dynamic"
] }
bevy_ecs_ldtk = { version = "0.5.0",default-features = true}

bevy_rapier2d = "0.20.0"
[workspace]
resolver = "2" # Important! wgpu/Bevy needs this!

Does someone have an idea?

Trouv commented 1 year ago

This is just a guess but are you looking at the example on the main branch of this repo? There've been some breaking changes since 0.5 and the examples have been updated accordingly. Try copying it from the tag v0.5.0: https://github.com/Trouv/bevy_ecs_ldtk/tree/v0.5.0/examples/platformer

miyoku157 commented 1 year ago

Well, sry for this issue^^. I didn't thought about possible breaking modification on git. There is no problem anymore. Thanks a lot for the quick answer.