Godot Version
4.7
Question
i made a code where if the player entered an area2d they a variable of the singleton woulve lower by 15 and if it got lower than 0 it wouldnt got lower than it and utted a print to see the damge on the output, the thing is that every time i enter the area its printed the value 100 on the output so instead of being something like 100. 85. 70. 55 its printed 100. 100. 100. 100. can someone tell me why this happens?
func _on_area_2d_body_entered(body: Node2D) -> void:
if body.is_in_group("player"):
bnuuy.heath -= 15
if bnuuy.health <= 0:
bnuuy.health = 0
print(bnuuy.health)