fixed bug with set_hp in damageable object

This commit is contained in:
akshay 2022-08-19 01:27:06 -04:00
parent 30b488094a
commit de19a4c32d

View File

@ -18,7 +18,8 @@ func _ready():
set_hp(starting_hp)
func take_damage(damage : int = 1):
set_hp(current_hp - max_hp)
assert(damage > 0)
set_hp(current_hp - damage)
func set_hp(hp_to_set : int):
current_hp = clamp(hp_to_set,0,max_hp)