fixed bug with set_hp in damageable object

This commit is contained in:
akshay committed 2022-08-19 01:27:06 -04:00
1 parent 30b488094a
commit de19a4c32d
1 file changed
+2 -1
+2 -1
View File
@@ -18,7 +18,8 @@ func _ready():
set_hp(starting_hp) set_hp(starting_hp)
func take_damage(damage : int = 1): 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): func set_hp(hp_to_set : int):
current_hp = clamp(hp_to_set,0,max_hp) current_hp = clamp(hp_to_set,0,max_hp)