I am trying to create a bundle with a sprite sheet which incapsulates most of the creation logic. How do I access textures resource there? Is there a better way to do this?
#[derive(Bundle)]
pub struct PowerUpBundle {
power_up: PowerUp,
#[bundle]
sprite_sheet: SpriteSheetBundle,
#[bundle]
sensor: (Collider, Sensor, ActiveEvents),
}
impl PowerUpBundle {
pub fn new(power_up: PowerUp) -> Self {
Self {
power_up,
sprite_sheet: match power_up {
PowerUp::AttackSpeed => // get texture atlas
PowerUp::RunSpeed => // get texture atlas
},
sensor: (
Collider::cuboid(8., 12.),
Sensor,
ActiveEvents::COLLISION_EVENTS,
),
}
}
}