cargo: fmt

This commit is contained in:
Muhammad Nauman Raza 2024-09-17 10:05:42 +01:00
parent 91d5deca3e
commit 36e0819af5
Signed by: devraza
GPG key ID: 91EAD6081011574B
4 changed files with 13 additions and 11 deletions

View file

@ -1,8 +1,8 @@
use bevy::prelude::*;
use std::f32::consts::PI;
use crate::player::*;
use crate::helpers::*;
use crate::player::*;
// Define the enemy component
#[derive(Component)]

View file

@ -15,4 +15,3 @@ pub struct CommonStats {
pub mana: f32,
pub mana_max: f32,
}

View file

@ -107,7 +107,7 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
stamina_max: 10.,
mana: 100.,
mana_max: 100.,
}
},
});
// Spawn an enemy
@ -131,6 +131,6 @@ fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
stamina_max: 8.,
mana: 50.,
mana_max: 50.,
}
},
});
}

View file

@ -116,14 +116,17 @@ pub fn render_ui(
egui::Grid::new("Stats")
.spacing(egui::Vec2::new(20., 10.))
.show(ui, |ui| {
let health_bar =
egui::widgets::ProgressBar::new(player.stats.health / player.stats.health_max)
let health_bar = egui::widgets::ProgressBar::new(
player.stats.health / player.stats.health_max,
)
.desired_width(window_width / 10.);
let mut stamina_bar = egui::widgets::ProgressBar::new(
player.stats.stamina / player.stats.stamina_max,
)
.desired_width(window_width / 10.);
let mana_bar =
egui::widgets::ProgressBar::new(player.stats.mana / player.stats.mana_max)
.desired_width(window_width / 10.);
let mut stamina_bar =
egui::widgets::ProgressBar::new(player.stats.stamina / player.stats.stamina_max)
.desired_width(window_width / 10.);
let mana_bar = egui::widgets::ProgressBar::new(player.stats.mana / player.stats.mana_max)
.desired_width(window_width / 10.);
// Show the stamina bar to be empty if the player has no stamina
if player.stats.stamina <= 0. {