![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | mangalala |
I have lots of instances of a node that I want to delete themselves when they enter an area.
The initial node that I have on the screen deletes itself fine but its instances do not (even though they are all being detected by the area). I’ve tried lots of stuff from the forum but I can’t figure it out.
In my code it’s known as sugar, and the area is known as bin. I’ve tried things like sugar_instance.instance().queue_free() but i can’t get it to work. Thanks in advance.
Main
Extends Node2D
onready var sugar_instance = preload("res://sugar.tscn")
func _process(delta):
add_child(sugar_instance.instance())
sugar
func _on_bin_area_body_entered(body):
print("Entering bin")
queue_free()