Why does my health bar disappear whenever my character takes amage?
- by iQue
Im making health bar for my game that looks like this:
public void healthBar(Canvas canvas)
{
float healthScale = happy.getHP() / happy.getMaxHP();
Rect rect = new Rect(20, 20,(120 * (int)healthScale), 40);
Paint paint = new Paint();
paint.setColor(Color.RED);
canvas.drawRect(20, 20, 220 * healthScale, 40, paint)
}
this is…