i dont know how to do it (and it working), yes i can drag the collision shape to the script and make something like this
func _on_area_2d_body_entered(body: Node2D) -> void:
if body.is_in_group("car"):
$"../collisionshape2".queue_free()
it simply does not work like that, then i tried using @onready like this
@onready var collision1 = $"../collisionshape2"
and then
func _on_area_2d_body_entered(body: Node2D) -> void:
if body.is_in_group("car"):
collision1.queue_free()
but it does not work too and i cant find the solution because i dont know the name of what i am triying to do to search it on the docs so thats why im here
(sorry if there are any spelling mistakes, english is not my first languaje)
What do you mean by “it does not work”? What do you expect to happen, and what happens instead? (Consider posting a screen recording of what happens if you can.) Do you get any warnings or errors? What does your scene tree look like?
the scene tree looks like this
characther body
-collisionshape2d
-sprite
-area 2d (script shown above and signal that calls the function)
—collisionshape2d
it then is placed in a level with the obstacles (cars) that are classified in the tag car
while running the game, if you crash, a sound plays and after 0.75 seconds it resets the level scene, what happens that if you move up and down quickly touching the car repeatedly, the sound plays repeatly because it detects again collision, so i am triying to remove the collision shape (not the son of the area2d, the one outside)
and what happens, well the collision shape stays (i can see it in debug mode), the log shows absolutely nothing and i cant find where’s the error
bind produces a copy of callable with defined args. Signal “ready” runs it. Flag 4 means one shot.
this will make test_node print text “DEBUG - string output: NODE READY”