v0.6.0: enemy health bars now always round up to the nearest pixel

This commit is contained in:
Evan Debenham 2017-05-14 13:40:43 -04:00
parent 2f8d7515c2
commit 7cdbb43818

View File

@ -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;
}