Add function documentation
All checks were successful
CI / Formatting (push) Successful in 1m30s

This commit is contained in:
Michael Bradley 2025-05-19 22:19:04 -04:00
parent fc95857824
commit 6a151397de
Signed by: MichaelBradley
SSH key fingerprint: SHA256:BKO2eI2LPsCbQS3n3i5SdwZTAIV3F1lHezR07qP+Ob0
7 changed files with 21 additions and 1 deletions

View file

@ -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>,