cargo: fmt
This commit is contained in:
parent
91d5deca3e
commit
36e0819af5
|
@ -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)]
|
||||
|
|
|
@ -15,4 +15,3 @@ pub struct CommonStats {
|
|||
pub mana: f32,
|
||||
pub mana_max: f32,
|
||||
}
|
||||
|
||||
|
|
|
@ -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.,
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
13
src/ui.rs
13
src/ui.rs
|
@ -116,13 +116,16 @@ 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)
|
||||
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)
|
||||
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
|
||||
|
|
Reference in a new issue