added second layer for start of pause menu stuff
This commit is contained in:
parent
a703f6ab85
commit
9de729fb7f
8 changed files with 247 additions and 11 deletions
|
|
@ -1,4 +1,6 @@
|
|||
use bevy::{post_process::bloom::Bloom, prelude::*, sprite::Anchor};
|
||||
use bevy::{
|
||||
camera::visibility::RenderLayers, post_process::bloom::Bloom, prelude::*, sprite::Anchor,
|
||||
};
|
||||
use rand::Rng;
|
||||
|
||||
use crate::{
|
||||
|
|
@ -26,6 +28,10 @@ impl Plugin for NaviGameplayPlugin {
|
|||
#[derive(Component)]
|
||||
pub struct PlayerVWBus;
|
||||
|
||||
#[derive(Component)]
|
||||
#[require(Camera2d)]
|
||||
struct MainCamera;
|
||||
|
||||
pub fn setup_scene(
|
||||
mut commands: Commands,
|
||||
mut meshes: ResMut<Assets<Mesh>>,
|
||||
|
|
@ -36,7 +42,16 @@ pub fn setup_scene(
|
|||
MeshMaterial2d(materials.add(Color::srgb(0.2, 0.2, 0.3))),
|
||||
));
|
||||
|
||||
commands.spawn((Camera2d, Bloom::NATURAL));
|
||||
commands.spawn((
|
||||
MainCamera,
|
||||
Camera {
|
||||
order: 1,
|
||||
// clear_color: ClearColorConfig::None,
|
||||
..default()
|
||||
},
|
||||
Bloom::NATURAL,
|
||||
RenderLayers::layer(0),
|
||||
));
|
||||
}
|
||||
|
||||
pub fn spawn_bus(mut commands: Commands, asset_server: Res<AssetServer>) {
|
||||
|
|
@ -106,9 +121,9 @@ pub fn move_player(
|
|||
}
|
||||
}
|
||||
|
||||
pub fn follow_player(
|
||||
mut camera: Single<&mut Transform, (With<Camera2d>, Without<PlayerVWBus>)>,
|
||||
player: Single<&Transform, (With<PlayerVWBus>, Without<Camera2d>)>,
|
||||
fn follow_player(
|
||||
mut camera: Single<&mut Transform, (With<MainCamera>, Without<PlayerVWBus>)>,
|
||||
player: Single<&Transform, (With<PlayerVWBus>, Without<MainCamera>)>,
|
||||
time: Res<Time>,
|
||||
) {
|
||||
let Vec3 { x, y, .. } = player.translation;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue