All Questions

Community

t
duong tuan

formula in func health above

in this chapter:

https://gdquest.mavenseed.com/lessons/ai-controlled-battlers

# Returns true if the `battler`'s health ratio is above `ratio`.
func _is_health_above(battler: Battler, ratio: float) -> bool:
    ratio = clamp(ratio, 0.0, 1.0)
    return battler.stats.health / battler.stats.max_health > battler.stats.health * ratio

it looks like the comparison formula should be:

func _is_health_above(battler: Battler, ratio: float) -> bool:
    ratio = clamp(ratio, 0.0, 1.0)
    return battler.stats.health / battler.stats.max_health > ratio


  • Nathan Lovato replied

    Thanks! I'll fix it now.