#Changing position while in state

12 messages · Page 1 of 1 (latest)

swift moss
#

Make a PlayerBundle for the player entity so that you can spawn it using commands.spawn(PlayerBundle::new(...)) and have separate systems with different in_set/run_if configurations that only run in a particular state

#

At least that's the canonical way of doing it. You can also have a simple condition like you've got here and just pass a different transform to SpriteSheetBundle

#

(or do a separate commands.insert(Transform::from_xyz(...)); at the end)

swift moss
#

Pretty much, yes

#

You can then add all Rapier components to the bundle as well

swift moss
#

You want to define that function on PlayerBundle. It's just a regular struct so you can add whatever interface you want to parametrize its creation

worthy ether
worthy ether
#

i think I understand now but I still get the same error @swift moss

struct PlayerBundle {
    #[bundle]
    sprite: SpriteSheetBundle,
    new: New
}```
#
pub struct New(f32); 
#

sorry if im bothering you btw

swift moss
#

I'd suggest you brushed up on Rust in general before trying to delve deeper into Bevy. You won't get far without knowing the basics first.

worthy ether
#

i thought a simple mut would work but idk maybe i do need to brush up again lol