+1 vote

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.

Godot version 3.3.3
in Engine by (32 points)

1 Answer

0 votes
func _on_area2d_body_entered(body):
    body.queue_free()
by (272 points)

Is it really that simple

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()

Thank you very much

Hope it works for you!

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.