Merge branch 'pfau/fix-healthbars' into 'master'

Fix healthbar background alignment

See merge request veloren/veloren!803
This commit is contained in:
Monty Marz 2020-02-16 10:58:44 +00:00
commit 26f670e5c3
5 changed files with 16 additions and 16 deletions

Binary file not shown.

BIN
assets/voxygen/element/frames/enemybar.png (Stored with Git LFS)

Binary file not shown.

BIN
assets/voxygen/element/frames/enemybar_bg.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -265,6 +265,7 @@ image_ids! {
// Enemy Healthbar
enemy_health: "voxygen.element.frames.enemybar",
enemy_health_bg: "voxygen.element.frames.enemybar_bg",
// Enemy Bar Content:
enemy_bar: "voxygen.element.skillbar.enemy_bar_content",
// Spell Book Window

View File

@ -695,20 +695,19 @@ impl Hud {
let ingame_pos = pos + Vec3::unit_z() * height_offset;
// Background
Rectangle::fill_with(
[82.0 * BARSIZE + 1.0, 8.0],
Color::Rgba(0.1, 0.1, 0.1, 0.9),
)
.x_y(0.0, MANA_BAR_Y + 7.0) //-25.0)
Image::new(self.imgs.enemy_health_bg)
.w_h(84.0 * BARSIZE, 10.0 * BARSIZE)
.x_y(0.0, MANA_BAR_Y + 6.5) //-25.5)
.color(Some(Color::Rgba(0.1, 0.1, 0.1, 0.8)))
.position_ingame(ingame_pos)
.set(back_id, ui_widgets);
// % HP Filling
Image::new(self.imgs.enemy_bar)
.w_h(72.9 * (hp_percentage / 100.0) * BARSIZE, 5.9 * BARSIZE)
.w_h(73.0 * (hp_percentage / 100.0) * BARSIZE, 6.0 * BARSIZE)
.x_y(
(4.5 + (hp_percentage / 100.0 * 36.45 - 36.45)) * BARSIZE,
MANA_BAR_Y + 9.0,
MANA_BAR_Y + 7.5,
)
.color(Some(if hp_percentage <= 25.0 {
crit_hp_color
@ -722,13 +721,13 @@ impl Hud {
// % Mana Filling
Rectangle::fill_with(
[
73.0 * (energy.current() as f64 / energy.maximum() as f64) * BARSIZE,
72.0 * (energy.current() as f64 / energy.maximum() as f64) * BARSIZE,
MANA_BAR_HEIGHT,
],
MANA_COLOR,
)
.x_y(
((4.5 + (energy_percentage / 100.0 * 36.5)) - 36.45) * BARSIZE,
((3.5 + (energy_percentage / 100.0 * 36.5)) - 36.45) * BARSIZE,
MANA_BAR_Y, //-32.0,
)
.position_ingame(ingame_pos)