changeable z index, with occlusion

This commit is contained in:
StephenAdamson
2024-12-17 21:30:46 +00:00
parent caacf4e072
commit d107626b32
4 changed files with 31 additions and 14 deletions
+21 -11
View File
@@ -55,17 +55,27 @@ pub struct DoorTile {
pub locked: bool,
}
// pub fn camera_z_movement(
// keyboard_input: Res<ButtonInput<KeyCode>>,
// mut z_index: ResMut<game::ZIndex>,
// ) {
// if keyboard_input.pressed(KeyCode::ShiftLeft) {
// z_index.0 -= 1.0;
// }
// if keyboard_input.pressed(KeyCode::ShiftRight) {
// z_index.0 += 1.0;
// }
// }
#[derive(Resource, Default)]
pub struct CameraMoved(pub bool);
// Modify camera_z_movement
pub fn camera_z_movement(
keyboard_input: Res<ButtonInput<KeyCode>>,
mut z_index: ResMut<game::ZIndex>,
mut camera_moved: ResMut<CameraMoved>,
) {
camera_moved.0 = false;
if keyboard_input.pressed(KeyCode::ShiftLeft) {
z_index.0 -= 1.0;
z_index.0 = z_index.0.clamp(-39.0, 5.0);
camera_moved.0 = true;
}
if keyboard_input.pressed(KeyCode::ShiftRight) {
z_index.0 += 1.0;
z_index.0 = z_index.0.clamp(-39.0, 5.0);
camera_moved.0 = true;
}
}
pub fn tile_sprite_occlusion(
mut query: Query<(&mut Visibility, &Transform, &Tile), With<Tile>>,