use crate::{assets::AssetLoader, movement::YSortable}; use bevy::prelude::*; #[derive(Component, Debug)] pub struct Statue; pub fn statue_at_position( assets: &Res, translation: Vec3, ) -> ( Statue, YSortable, bevy::prelude::SpriteBundle, bevy::prelude::TextureAtlas, ) { ( Statue, YSortable, SpriteBundle { transform: Transform::from_translation(translation), texture: assets.images.statue.clone(), ..default() }, TextureAtlas { layout: assets.layouts.statue.clone(), ..default() }, ) } pub fn startup(mut commands: Commands, assets: Res) { commands.spawn(statue_at_position(&assets, Vec3::new(50., 50., 0.))); commands.spawn(statue_at_position(&assets, Vec3::new(50., 100., 0.))); } pub fn exit(mut commands: Commands, q: Query>) { for id in q.iter() { commands.entity(id).despawn_recursive(); } }