I'm trying to create a health bar using java.awt but the width of the bar doesn't display. The first line of code works fine and creates a rectangle as expected, but the second doesn't draw anything. It doesn't throw an error either. The only difference between the working rect and the non working rect is the width parameter.
Health is an int and 400 * (health/5) always produces an int.
I've tried creating a variable that calculates this and putting it in place of the calc in the fillRect but it makes no difference. Someone please explain why this doesn't work!
g.fillRect(WIDTH/4, HEIGHT - 80, 400, 40);
g.setColor(Color.red);
g.fillRect(WIDTH/4,HEIGHT - 80, 400 * (health/5), 40);