This commit is contained in:
parent
fc95857824
commit
6a151397de
7 changed files with 21 additions and 1 deletions
|
|
@ -6,6 +6,7 @@ use bevy::{
|
|||
|
||||
use super::objects::Player;
|
||||
|
||||
/// Move the player character based on the keyboard input
|
||||
pub fn move_player(
|
||||
time: Res<Time>,
|
||||
keyboard_input: Res<ButtonInput<KeyCode>>,
|
||||
|
|
@ -31,10 +32,12 @@ pub fn move_player(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Neatly exit game
|
||||
pub fn quit(mut exit: EventWriter<AppExit>) {
|
||||
exit.write(AppExit::Success);
|
||||
}
|
||||
|
||||
/// Follow the player character with the camera
|
||||
pub fn move_camera(
|
||||
mut camera: Single<&mut Transform, (Without<Player>, With<IsDefaultUiCamera>)>,
|
||||
player: Single<&Transform, (With<Player>, Without<IsDefaultUiCamera>)>,
|
||||
|
|
@ -42,6 +45,7 @@ pub fn move_camera(
|
|||
camera.translation = camera.translation.lerp(player.translation, 0.05);
|
||||
}
|
||||
|
||||
/// Adjust the camera zoom based on the scroll wheel input
|
||||
pub fn zoom_camera(
|
||||
mut camera: Single<&mut Projection, With<IsDefaultUiCamera>>,
|
||||
scroll: Res<AccumulatedMouseScroll>,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue