Area2D body entered but never exit
So I'm trying to make my character take damage when entering an area2d node, but how do I keep it constantly trigger even if my character doesn't leave the area2d?
If happens only once but then it feels like I'm riding the wolf now XD
There's 2 CollisionShape2D that I use for the wolf, one for the KinematicBody and the other for Area2D
I also made the CollisionShape2D for the Area2D slightly bigger.
Here the coding I use:
func _on_Area2D_body_entered(body): if "Player" in body.name: body.dead()
func dead(): hp -= 1 if hp <= 0: is_dead = true velocity = Vector2(0,0) $AnimatedSprite/AnimationPlayer.play("dead") $CollisionShape2D.set_deferred("disabled",true) else: is_hurt = true velocity.x = 0 $AnimatedSprite/AnimationPlayer.play("hurt")
Is there a possible way to do so?
Thanks in advance!