+1 vote

Hi. I have an enemy node (KinematicBody2D) and a player. When the player's sword detects enemy body entered it is going to call enemy's take_damage func but it is throwing an error.
some snippets:


func _on_Sword_body_entered(body):
if body.is_in_group("enemy"):


func take_damage(count):
hp -= count

couldnt be simpler, yet, this doesnt work and im curious why

in Engine by (30 points)

What the print shows?
You probably made a mistake somewhere. This could include adding a wrong scene to the group or no script attached to the enemy instance due to a script error.

print show the body name correctly

1 Answer

0 votes

Do this tutorial is of any help? https://www.youtube.com/watch?v=JBczf8qt04c

by (1,044 points)
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.