Destroying enemies

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By cobracon

In the game I’m making I have melee combat. Right know I have 4 collisions to detect the enemies and to see if attack animation is playing but because this is in the player script I don’t know how to destroy the enemy.

:bust_in_silhouette: Reply From: Snail0259
func _on_area2d_body_entered(body):
    body.queue_free()

Is it really that simple

cobracon | 2021-07-10 12:26

It should be. You need to go into the signals part of the node tab on the right side of the window, and then connect your area2d on body entered node to a script, and put body.queue_free()

Snail0259 | 2021-07-10 12:32

Thank you very much

cobracon | 2021-07-10 12:35

Hope it works for you!

Snail0259 | 2021-07-10 12:36