assets: Using new lockpick and stairs sprites

- Fixed stairs transparency
This commit is contained in:
Alexey 2026-03-26 12:01:58 +03:00
commit c5c6378303
3 changed files with 13 additions and 5 deletions

View file

@ -3,7 +3,7 @@ use bevy::prelude::*;
use super::*;
// TODO: replace with proper sprite
const LOCKPICK_SPRITE: &'static str = "sprites/items/choco_bar.png";
const LOCKPICK_SPRITE: &'static str = "sprites/items/lockpick.png";
#[derive(Component, Debug, PartialEq, Eq, Default, Clone, Copy, Reflect)]
#[reflect(Component, Debug, PartialEq, Default, Clone)]

View file

@ -5,6 +5,8 @@ use crate::{meters, player::Player};
use super::*;
const STAIRS_SPRITE_PATH: &'static str = "sprites/interactive/stairs.png";
#[derive(Component, Debug, PartialEq, Eq, Default, Clone, Copy, Reflect)]
#[reflect(Component, Debug, PartialEq, Default, Clone)]
#[require(InteractiveObject, Collider, Sensor)]
@ -62,11 +64,12 @@ pub fn on_stairs_interact(
}
pub fn stairs_bundle(
_asset_server: &Res<AssetServer>,
asset_server: &Res<AssetServer>,
position: Vec2,
up_position: Option<Vec2>,
down_position: Option<Vec2>,
) -> impl Bundle {
let image = asset_server.load(STAIRS_SPRITE_PATH);
let (has_up, has_down) = (up_position.is_some(), down_position.is_some());
(
Stairs {
@ -74,7 +77,8 @@ pub fn stairs_bundle(
down: down_position,
},
Transform::from_xyz(position.x, position.y, -1.),
Children::spawn(
InheritedVisibility::VISIBLE,
Children::spawn((
SpawnWith(move |parent: &mut RelatedSpawner<ChildOf>| {
if has_up {
parent.spawn((
@ -82,6 +86,10 @@ pub fn stairs_bundle(
Collider::cuboid(meters(1.), meters(1.)),
Transform::from_xyz(meters(-1.), 0., 0.),
));
parent.spawn((
Sprite::from_image(image),
Transform::from_xyz(0., meters(1.5), 0.),
));
}
if has_down {
@ -91,8 +99,8 @@ pub fn stairs_bundle(
Transform::from_xyz(meters(1.), 0., 0.),
));
}
})
),
}),
)),
Name::new(format!("Stairs ({},{})", position.x, position.y))
)
}