2024-07-29 16:54:43 -05:00
|
|
|
use crate::{assets::AssetLoader, movement::YSortable};
|
2024-07-29 16:29:39 -05:00
|
|
|
use bevy::prelude::*;
|
2023-12-23 16:50:08 -06:00
|
|
|
|
|
|
|
#[derive(Component, Debug)]
|
|
|
|
pub struct Statue;
|
|
|
|
|
2024-07-30 12:56:30 -05:00
|
|
|
pub fn statue_at_position(
|
|
|
|
assets: &Res<AssetLoader>,
|
|
|
|
translation: Vec3,
|
|
|
|
) -> (
|
|
|
|
Statue,
|
|
|
|
YSortable,
|
|
|
|
bevy::prelude::SpriteBundle,
|
|
|
|
bevy::prelude::TextureAtlas,
|
|
|
|
) {
|
|
|
|
(
|
2023-12-23 16:50:08 -06:00
|
|
|
Statue,
|
2024-07-29 16:54:43 -05:00
|
|
|
YSortable,
|
2024-07-30 12:56:30 -05:00
|
|
|
SpriteBundle {
|
|
|
|
transform: Transform::from_translation(translation),
|
|
|
|
texture: assets.images.statue.clone(),
|
|
|
|
..default()
|
2023-12-23 16:50:08 -06:00
|
|
|
},
|
2024-07-30 12:56:30 -05:00
|
|
|
TextureAtlas {
|
|
|
|
layout: assets.layouts.statue.clone(),
|
|
|
|
..default()
|
2023-12-23 16:50:08 -06:00
|
|
|
},
|
2024-07-30 12:56:30 -05:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn startup(mut commands: Commands, assets: Res<AssetLoader>) {
|
|
|
|
commands.spawn(statue_at_position(&assets, Vec3::new(50., 50., 0.)));
|
|
|
|
commands.spawn(statue_at_position(&assets, Vec3::new(50., 100., 0.)));
|
2023-12-23 16:50:08 -06:00
|
|
|
}
|
2024-07-29 16:29:39 -05:00
|
|
|
|
|
|
|
pub fn exit(mut commands: Commands, q: Query<Entity, With<Statue>>) {
|
|
|
|
for id in q.iter() {
|
|
|
|
commands.entity(id).despawn_recursive();
|
|
|
|
}
|
|
|
|
}
|