Is there a better way to do this:

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Johnnyfantastic6
func _on_Hurtbox_area_entered(_area):
variable = true

func _on_Hurtbox_area_exited(_area):
variable = false

it’s ugly and I want to make it look better

:bust_in_silhouette: Reply From: dustin

firstly, are you gonna make use of the overlapping bodies properties? if you are, thats not a good solution.

second, if you just want to check if there is nothing overlapping your area, just do this:

func _process():
    variable = ($area2d.get_overlapping_bodies() == []) #empty or not (true/false)