generated from 2ndbeam/bevy-template
feat: Functionally working stairs without sprite
- Made all observers public - Observe all InteractionEvents in the app, not in the entity - Added names to layout bundles - Raised player speed to 4 m/s for quicker debugging - Added second container on 2nd floor
This commit is contained in:
parent
764e196d39
commit
5157450ced
7 changed files with 129 additions and 9 deletions
|
|
@ -20,7 +20,7 @@ const CRATE_CLOSED_ASSET: &'static str = "sprites/interactive/crate_closed.png";
|
|||
#[require(Sprite, InteractiveObject, Inventory)]
|
||||
pub struct Container;
|
||||
|
||||
fn on_container_interact(
|
||||
pub fn on_container_interact(
|
||||
event: On<InteractionEvent>,
|
||||
mut commands: Commands,
|
||||
locked_query: Query<(), With<Locked>>,
|
||||
|
|
@ -42,7 +42,7 @@ pub fn container_bundle(
|
|||
asset_server: &Res<AssetServer>,
|
||||
position: Vec2,
|
||||
inventory_size: UVec2,
|
||||
items: Vec<Item>
|
||||
items: Vec<Item>,
|
||||
) -> impl Bundle {
|
||||
let image = asset_server.load(CRATE_CLOSED_ASSET);
|
||||
(
|
||||
|
|
@ -50,7 +50,6 @@ pub fn container_bundle(
|
|||
Transform::from_xyz(position.x, position.y - meters(0.5), 0.),
|
||||
Sprite::from_image(image),
|
||||
Inventory::new(inventory_size),
|
||||
Observer::new(on_container_interact),
|
||||
Children::spawn((
|
||||
SpawnIter(items.into_iter()),
|
||||
Spawn((
|
||||
|
|
@ -59,5 +58,6 @@ pub fn container_bundle(
|
|||
Transform::from_xyz(0., meters(0.5), 0.),
|
||||
)),
|
||||
)),
|
||||
Name::new(format!("Container {}x{}", inventory_size.x, inventory_size.y)),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue