How to queue free parent with child

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Newby
:warning: Old Version Published before Godot 3 was released.

When i kill my enemy the area2d and sprite queue_free but not my collision, let you know my detection code is on a different script (on my area2d) and movement in another (on my rigid body) my rigid body is the parent and the area2d is a child how can i make the child queue_free the parent

:bust_in_silhouette: Reply From: Kermer

Adding some screenshot would make it easier for you to explain and others to understand what you are trying to do.

If I understand correctly, your node tree looks something like this

Node Tree

And your code something like this

extends Area2D

func _on_body_enter(body):
	queue_free()

If so, then you probably just want to do

extends Area2D

func _on_body_enter(body):
	get_parent().queue_free()

Or, if the parent has a script, connect the Area2D signal to the parent directly.

eons | 2017-11-18 21:33

how do i do that

Newby | 2017-11-19 04:40