0 votes

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

asked Jul 10, 2019 in Engine by szaross (28 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

answered Jul 10, 2019 by BraindeadBZH (1,020 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.