0 votes
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

in Engine by (36 points)

1 Answer

0 votes

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)
by (439 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.