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-29 16:29:39 -05:00
|
|
|
pub fn startup(mut commands: Commands, assets: Res<AssetLoader>, asset_server: Res<AssetServer>) {
|
2024-05-17 09:57:24 -05:00
|
|
|
let texture = asset_server.load("img/Props.png");
|
2023-12-23 16:50:08 -06:00
|
|
|
commands.spawn((
|
|
|
|
Statue,
|
2024-07-29 16:54:43 -05:00
|
|
|
YSortable,
|
2023-12-23 16:50:08 -06:00
|
|
|
SpriteSheetBundle {
|
2024-05-17 09:57:24 -05:00
|
|
|
texture: texture.clone(),
|
|
|
|
atlas: TextureAtlas {
|
|
|
|
layout: assets.images.statue.clone(),
|
|
|
|
index: 0,
|
|
|
|
},
|
2023-12-23 16:50:08 -06:00
|
|
|
transform: Transform::from_translation(Vec3::new(50., 50., 0.)),
|
|
|
|
..Default::default()
|
|
|
|
},
|
|
|
|
));
|
|
|
|
commands.spawn((
|
|
|
|
Statue,
|
2024-07-29 16:54:43 -05:00
|
|
|
YSortable,
|
2023-12-23 16:50:08 -06:00
|
|
|
SpriteSheetBundle {
|
2024-05-17 09:57:24 -05:00
|
|
|
texture: texture.clone(),
|
|
|
|
atlas: TextureAtlas {
|
|
|
|
layout: assets.images.statue.clone(),
|
|
|
|
index: 0,
|
|
|
|
},
|
2023-12-23 16:50:08 -06:00
|
|
|
transform: Transform::from_translation(Vec3::new(50., 100., 0.)),
|
|
|
|
..Default::default()
|
|
|
|
},
|
|
|
|
));
|
|
|
|
}
|
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();
|
|
|
|
}
|
|
|
|
}
|