cargo: fmt

This commit is contained in:
Muhammad Nauman Raza 2024-03-22 21:13:08 +00:00
parent a8a342c379
commit f34c4a4803
Signed by: devraza
GPG key ID: 91EAD6081011574B
3 changed files with 26 additions and 22 deletions

View file

@ -57,7 +57,10 @@ fn main() {
.init_resource::<UiState>()
.init_resource::<OpenWindows>()
.add_systems(Startup, (setup, setup_ui))
.add_systems(Update, (render_ui, movement, camera_follow, player_regen, attack))
.add_systems(
Update,
(render_ui, movement, camera_follow, player_regen, attack),
)
.run();
}

View file

@ -72,7 +72,7 @@ pub fn attack(
keys: Res<ButtonInput<KeyCode>>,
mut set: ParamSet<(
Query<&mut Transform, With<Attack>>,
Query<&Transform, With<Player>>
Query<&Transform, With<Player>>,
)>,
mut player_query: Query<&mut Player>,
mut commands: Commands,
@ -81,7 +81,8 @@ pub fn attack(
let mut player = player_query.single_mut();
for player_transform in set.p1().iter_mut() {
let attack_position = player_transform.translation + ((player_transform.rotation * Vec3::Y) * 100.);
let attack_position =
player_transform.translation + ((player_transform.rotation * Vec3::Y) * 100.);
if keys.just_pressed(KeyCode::Enter) {
commands

View file

@ -118,12 +118,12 @@ pub fn render_ui(
.show(ui, |ui| {
let health_bar = egui::widgets::ProgressBar::new(player.health)
.desired_width(window_width / 10.);
let mut stamina_bar = egui::widgets::ProgressBar::new(player.stamina / player.stamina_max)
let mut stamina_bar =
egui::widgets::ProgressBar::new(player.stamina / player.stamina_max)
.desired_width(window_width / 10.);
let mana_bar = egui::widgets::ProgressBar::new(player.mana / player.mana_max)
.desired_width(window_width / 10.);
// Show the stamina bar to be empty if the player has no stamina
if player.stamina <= 0. {
stamina_bar =