Skip to content

ArmourBar

class ArmourBar(
healthBar: HealthBarDefinition,
currentPercentage: Int = 100,
animationSpeed: Int = 0
) : OverheadBar(healthBar = healthBar, currentPercentage = currentPercentage, animationSpeed = animationSpeed)
Example
fun showArmour(npc: Npc, bar: HealthBarDefinition, armour: Int, maxArmour: Int) {
val shown = npc.findComponent<ArmourBar>() ?: ArmourBar(bar).also { npc.addComponent(it) }
shown.currentPercentage = armour * 100 / maxArmour
}