From 7cdbb43818020ac98d61908a8e2bc79dede074bf Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Sun, 14 May 2017 13:40:43 -0400 Subject: [PATCH] v0.6.0: enemy health bars now always round up to the nearest pixel --- .../shatteredpixeldungeon/ui/HealthBar.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/HealthBar.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/HealthBar.java index 63c2fd658..8e803045c 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/HealthBar.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/HealthBar.java @@ -61,8 +61,12 @@ public class HealthBar extends Component { Bg.y = Shld.y = Hp.y = y; Bg.size( width, HEIGHT ); - Shld.size( width * shield, HEIGHT ); - Hp.size( width * health, HEIGHT ); + + //logic here rounds up to the nearest pixel + float pixelWidth = width; + if (camera() != null) pixelWidth *= camera().zoom; + Shld.size( width * (float)Math.ceil(shield * pixelWidth)/pixelWidth, HEIGHT ); + Hp.size( width * (float)Math.ceil(health * pixelWidth)/pixelWidth, HEIGHT ); height = HEIGHT; }