Making Area2D continuously check collision

Godot Version 4.3

How can I make my character take damage continuously if enemy body entered and never exited HurtBox? I’ve struggled and looked at a number (like might be 6hrs of research). I’ve only started learning coding and godot last week.

Here’s my PLAYER script:

extends CharacterBody2D

signal player_hit

@export var max_health: float = 100.0
@export var speed: int = 1000
var current_health = max_health


func _physics_process(_delta: float) -> void:
	var direction = Input.get_vector("left","right","up","down")
	velocity = direction * speed
	move_and_slide()
	
	
func _on_hurt_box_area_entered(area: Area2D) -> void:
	print("Player hurt")
	if area.get_parent().has_method("get_damage_amount"):
		var node = area.get_parent() as Node
		current_health -= node.damage_amount
		print("Player Health amount: ", current_health)

and ENEMY script:

extends CharacterBody2D


@export var max_health: float = 5.0
var speed: int = 100
var current_health = max_health
@export var damage_amount = 1.0
@onready var player = get_node("/root/Level/Player")



func _ready() -> void:
	current_health = max_health


func _physics_process(_delta: float) -> void:
	var direction = global_position.direction_to(player.global_position)
	velocity = direction * speed
	move_and_slide()
	
	
func _on_hurt_box_area_entered(area: Area2D) -> void:
	pass
	#print("Enemy Hurtbox area entered")
	#if area.get_parent().has_method("get_damage_amount"):
		#var node = area.get_parent() as Node
		#current_health -= node.damage_amount
		#print("Health amount: ", current_health)


func _on_hit_box_area_entered(area: Area2D) -> void:
	print("Enemy area entered")
	

func _on_hit_box_body_entered(body: Node2D) -> void:
	print("Enemy body entered")
	
func get_damage_amount() -> int:
	return damage_amount

The enemy only damages the player once when its body hitbox the hurtbox. Thanks in advance!

PS - I also have this issue where when the enemy body collides with the player, it sticks to the player body and never lets go lol. its a mess

You need to store information that the player entered the hurtbox as a boolean member is, and set it to true when player enters, and set it to false when player exits.
Then you just need to calculate damage in the _process() method depending if that variable is true or false.